<aside> đ Links (Property base class)
Notion Ruby Mapping Public API Reference
</aside>
<aside> âšī¸ â Table of Contents
</aside>
<aside> đĄ [P] means methods for Page Property, [D] means methods for Database Property.
</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["TextTitle"][0]
# => #<NotionRubyMapping::TextObject:...>
db.properties["TextTitle"][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.
prtp = page.properties["TextTitle"]
prtp << "Added text"
=> #<NotionRubyMapping::TextObject:0x000000010fc60d80 @options={"plain_text"=>"Added text"}, @text="Added text", @type="text", @will_update=false>
prtp.full_text
=> "new textAdded text"
prtp << MentionObject.new("template_mention" => "now")
=> => #<NotionRubyMapping::MentionObject:0x00000001100d2620 @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.
prtp = page.properties["TextTitle"]
prtp.count
# => 1
prtp.map(&:text)
# => ["new text"]
filter_contains
creates a Query object for contains
filter.
db.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)
db.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_does_not_contain
creates a Query object for does_not_contain
filter.
db.properties["CreatedByTitle"].filter_does_not_contain "a_user_id"
=> #<NotionRubyMapping::Query:0x0000000110666b68 @filter={"property"=>"CreatedByTitle", "created_by"=>{"does_not_contain"=>"a_user_id"}}, @page_size=100, @sort=[], @start_cursor=nil>
### only RollupProperty (none, any, every)
db.properties["CreatedByTitle"].filter_does_not_contain "abc", condition: "every", another_type: "people"
# => #<NotionRubyMapping::Query:0x000000010533e888 @filter={"property"=>"RollupTitle", "every"=>{"people"=>{"does_not_contain"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>