<aside> 👉 Links (Property base class)
Notion Ruby Mapping Public API Reference
</aside>
self[num] delegates to included @text_object[num].
self[num] of Page property returns a RichTextObject corresponded to num
self[num] of Database property returns nil, because @text_object of the property is {}.
page.properties["Title"][0]
# => #<NotionRubyMapping::TextObject:...>
db.properties["Title"][0]
# => nil
self << to delegates to included @text_object << to. If the argument is a String, it is converted to RichTextObject and append to @text_object. This method returns generated or given RichTextObject.
ptp = page.properties["Title"]
ptp << "Added text"
# => #<NotionRubyMapping::TextObject:0x0000000108f79960 @options={"plain_text"=>"Added text"}, @text="Added text", @type="text", @will_update=false>
ptp.full_text
# => "MNOAdded text"
ptp << MentionObject.new("template_mention" => "now")
# => #<NotionRubyMapping::MentionObject:0x0000000109739f60 @options={"template_mention"=>"now"}, @type="mention">
[P] self.each → Enumerator
self.each delegates to included @text_object.each. Since RichTextProperty includes Enumerable, other Enumerable methods can be used.
ptp = page.properties["Title"]
ptp.count
# => 1
ptp.map(&:text)
# => ["MNO"]
filter_contains creates a Query object for contains filter.
ds.properties["CreatedByTitle"].filter_contains "a_user_id"
# => #<NotionRubyMapping::Query:0x0000000110525498 @filter={"property"=>"CreatedByTitle", "created_by"=>{"contains"=>"a_user_id"}}, @page_size=100, @sort=[], @start_cursor=nil>
### only RollupProperty (none, any, every)
ds.properties["RollupTitle"].filter_contains "abc", condition: "any", another_type: "rich_text"
# => #<NotionRubyMapping::Query:0x0000000105394f30 @filter={"property"=>"RollupTitle", "any"=>{"rich_text"=>{"contains"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>
filter_contains creates a Query object for contains filter.
ds.properties["CreatedByTitle"].filter_contains "a_user_id"
# => #<NotionRubyMapping::Query:0x0000000110525498 @filter={"property"=>"CreatedByTitle", "created_by"=>{"contains"=>"a_user_id"}}, @page_size=100, @sort=[], @start_cursor=nil>
### only RollupProperty (none, any, every)
ds.properties["RollupTitle"].filter_contains "abc", condition: "any", another_type: "rich_text"
# => #<NotionRubyMapping::Query:0x0000000105394f30 @filter={"property"=>"RollupTitle", "any"=>{"rich_text"=>{"contains"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>
filter_ends_with(str) creates a Query object for ends_with filter.
ds.properties["MailTitle"].filter_ends_with "ac.jp"
=> #<NotionRubyMapping::Query:0x0000000105281b48 @filter={"property"=>"MailTitle", "email"=>{"ends_with"=>"ac.jp"}}, @page_size=100, @sort=[], @start_cursor=nil>
### only RollupProperty (none, any, every)
ds.properties["RollupTitle"].filter_ends_with "abc", condition: "none", another_type: "rich_text"
# => #<NotionRubyMapping::Query:0x00000001054d9558 @filter={"property"=>"RollupTitle", "none"=>{"rich_text"=>{"ends_with"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>