<aside> 👉 Links (Property base class)

ButtonProperty

CheckboxProperty

CreatedByProperty

CreatedTimeProperty

DateProperty

EmailProperty

FilesProperty

FormulaProperty

MultiSelectProperty

LastEditedByProperty

LastEditedTimeProperty

NumberProperty

PeopleProperty

PhoneNumberProperty

Property

RelationProperty

RichTextProperty

RollupProperty

SelectProperty

StatusProperty

TitleProperty

UniqueIdProperty

UrlProperty

VerificationProperty

Notion Ruby Mapping Public API Reference

</aside>

<aside> 💡

[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.

</aside>

1. Instance methods

[P] self[num] → RichTextObject or nil

Returns the rich text object at the given index, or nil if the index is out of range. num is an integer index; negative indexes count from the end.

page.properties["TextTitle"][0]
# => #<NotionRubyMapping::TextObject:...>

[P] self << to → RichTextObject

Appends a rich text object and marks the property for update. to is a String or RichTextObject. A String is converted to a TextObject; an existing RichTextObject is used directly. Returns the object that was added. This operation does not itself save the page.

prtp = page.properties["TextTitle"]
prtp << "Added text"
# => #<NotionRubyMapping::TextObject:...>

[P] self.each { |item| ... } → Array

[P] self.each → Enumerator

With a block, yields each RichTextObject and returns the underlying Array, not the RichTextProperty. Without a block, returns an Enumerator. Enumerable methods are also available.

prtp = page.properties["TextTitle"]
prtp.map(&:text)
# => ["new text"]

Filter usage

These methods return a Query; .filter in the examples reads its generated Hash. Creating a condition does not send an API request or update the property value.

For ordinary rich_text filters, omit condition: and another_type:. The shared methods accept these keywords for nested Formula / Rollup conditions; they are not needed for the examples below. The filter methods do not validate or normalize the supplied string.

[DB/DS] filter_contains(value) → Query

Creates a Query object whose rich_text condition matches a value that contains the given string. The value argument is a String and is passed to the filter unchanged.

ds.properties["TextTitle"].filter_contains("Notion").filter
# => {"property" => "TextTitle", "rich_text" => {"contains" => "Notion"}}

[DB/DS] filter_does_not_contain(value) → Query

Creates a Query object whose rich_text condition matches a value that does not contain the given string. The value argument is a String and is passed to the filter unchanged.