Class: Notion::Api::BlocksMethods

Inherits:
Object
  • Object
show all
Includes:
RequestClient
Defined in:
lib/notion-sdk-ruby/api/blocks.rb

Instance Method Summary collapse

Instance Method Details

#childrenNotion::Api::BlocksChildrenMethods



7
8
9
# File 'lib/notion-sdk-ruby/api/blocks.rb', line 7

def children
  BlocksChildrenMethods.new
end

#retrieve(id) ⇒ Notion::Block

Retrieves a Block object using the ID specified. developers.notion.com/reference/retrieve-a-block

Parameters:

  • id (String)

    block_id

Returns:



15
16
17
18
# File 'lib/notion-sdk-ruby/api/blocks.rb', line 15

def retrieve(id)
  response = get("/v1/blocks/#{id}")
  Block.new(response.body)
end

#update(id, body) ⇒ Notion::Block

Updates the content for the specified block_id based on the block type. developers.notion.com/reference/update-a-block

Parameters:

  • id (String)

    block_id

  • body (Hash)

Returns:



25
26
27
28
# File 'lib/notion-sdk-ruby/api/blocks.rb', line 25

def update(id, body)
  response = patch("/v1/blocks/#{id}", body.to_json)
  Block.new(response.body)
end