<aside> 👉 Links (Block base class)

Page

Block

CalloutBlock

DividerBlock

Heading1Block

LinkPreviewBlock

PdfBlock

TemplateBlock (Deprecated)

ToggleHeading2Block

Database 🚧

BookmarkBlock

CodeBlock

EmbedBlock

Heading2Block

LinkToPageBlock

QuoteBlock

ToDoBlock

ToggleHeading3Block

DataSource 🆕 🚧

BreadcrumbBlock

ColumnBlock

EquationBlock

Heading3Block

NumberedListItemBlock

SyncedBlock

ToggleBlock

VideoBlock

List

BulletedListItemBlock

ColumnListBlock

FileBlock

ImageBlock

ParagraphBlock

TableOfContentsBlock

ToggleHeading1Block

Notion Ruby Mapping Public API Reference

</aside>

1. Instance methods

each { |item| ... } → self

each → Enumerator

db.query_database and other API list results returns a List object. The list object is an Enumerable object, so usually combines with .each method. Each Page or Block object is automatically mapped to a Ruby object when passed to a Ruby block.

Notion API returns only the first page-size objects. The default page-size of this library is 100. The page-size can be changed in Query object. Since the above .each method is supported for paging, it will automatically execute API call that obtain the following page-size objects when you used the first page-size objects. Users do not have to worry about paging.

db.query_database(query).each do |page|
  # exec some methods for a page object
end