<aside> 👉

Links (Block base class)

Page

AudioBlock

Block

CodeBlock

EmbedBlock

Heading2Block

LinkPreviewBlock

PdfBlock

TableOfContentsBlock

ToggleHeading1Block

VideoBlock

Database

BookmarkBlock

CalloutBlock

ColumnBlock

EquationBlock

Heading3Block

LinkToPageBlock

QuoteBlock

TableRowBlock

ToggleHeading2Block

DataSource 🆕

BreadcrumbBlock

ChildDatabaseBlock

ColumnListBlock

FileBlock

Heading4Block

NumberedListItemBlock

SyncedBlock

ToDoBlock

ToggleHeading3Block

List

BulletedListItemBlock

ChildPageBlock

DividerBlock

Heading1Block

ImageBlock

ParagraphBlock

TableBlock

ToggleBlock

ToggleHeading4Block

Notion Ruby Mapping Public API Reference

</aside>

1. Class methods

self.new(array_array_of_text_objects = [], _table_width = 3) → TableRowBlock

Creates one row of a table. Each outer Array element represents one cell, and each cell is converted to an Array of rich text objects.

row = TableRowBlock.new(
  [
    "Name",
    ["hkob\n", TextObject.new("profile", "href" => "<https://example.com/>")],
    [],
  ],
)

<aside> ⚠️

A TableRowBlock is a public API and can be created independently, but it can only be appended as a child of a TableBlock. The row width is checked by the table when the row is added or the table is serialized.

</aside>

2. Instance methods

cells → Array<Array<RichTextObject>>

Returns the cells as an Array. Each cell is an Array of rich text objects. An empty cell is represented by an empty Array, while an empty String remains one rich text object whose content is empty.

row = TableRowBlock.new(["First", %w[Second Third], []])
row.cells
# => [[#<NotionRubyMapping::TextObject:...>],
#     [#<NotionRubyMapping::TextObject:...>, #<NotionRubyMapping::TextObject:...>],
#     []]

cells=(array_array_of_text_objects)

Replaces the complete cells Array and marks cells for the next row-block update. NotionRubyMapping does not provide a separate public API for updating one cell; modify the current values and assign the complete Array through cells=.

row = Block.find "table_row_block_id"
row.cells = %w[Updated Values]
row.save