Module: Notion::Api::Endpoints::Blocks
- Included in:
- Notion::Api::Endpoints
- Defined in:
- lib/notion/api/endpoints/blocks.rb
Instance Method Summary collapse
-
#block_append_children(options = {}) ⇒ Object
Creates and appends new children blocks to the parent block in the requested path using the ID specified.
-
#block_children(options = {}) ⇒ Object
Returns a paginated array of Block objects contained in the block of the requested path using the ID specified.
Instance Method Details
#block_append_children(options = {}) ⇒ Object
Creates and appends new children blocks to the parent block in the requested path using the ID specified. Returns the Block object being appended to.
Returns a 404 HTTP response if any of the following are true:
-
the ID does not exist
-
the bot doesn’t have access to the block with the given ID
Returns a 400 or 429 HTTP response if the request exceeds Notion’s Request limits.
46 47 48 49 |
# File 'lib/notion/api/endpoints/blocks.rb', line 46 def block_append_children( = {}) throw ArgumentError.new('Required arguments :id missing') if [:id].nil? patch("blocks/#{options[:id]}/children", ) end |
#block_children(options = {}) ⇒ Object
Returns a paginated array of Block objects contained in the block of the requested path using the ID specified.
Returns a 404 HTTP response if any of the following are true:
-
the ID does not exist
-
the bot doesn’t have access to the block with the given ID
Returns a 400 or 429 HTTP response if the request exceeds Notion’s Request limits.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/notion/api/endpoints/blocks.rb', line 19 def block_children( = {}) throw ArgumentError.new('Required arguments :id missing') if [:id].nil? if block_given? Pagination::Cursor.new(self, :block_children, ).each do |page| yield page end else get("blocks/#{options[:id]}/children", ) end end |