class NotionRb::Api::Update

Public Class Methods

new(params) click to toggle source
Calls superclass method NotionRb::Api::Base::new
# File lib/notion_rb/api/update.rb, line 6
def initialize(params)
  super

  @title = params[:title]
  @block_type = params[:block_type]
end

Private Instance Methods

params() click to toggle source
# File lib/notion_rb/api/update.rb, line 19
def params
  {
    requestId: SecureRandom.uuid,
    transactions: [{
      id: SecureRandom.uuid,
      operations: [{
        id: @notion_id,
        table: 'block',
        path: %w[properties title],
        command: 'set',
        args: [[@title]]
      }]
    }, {
      id: SecureRandom.uuid,
      operations: [{
        id: @notion_id,
        table: 'block',
        path: [],
        command: 'update',
        args: { type: @block_type }
      }]
    }]
  }
end
url() click to toggle source
# File lib/notion_rb/api/update.rb, line 15
def url
  'submitTransaction'
end