<aside> 👉 Links (Property base class)

CheckboxProperty

DateProperty

FormulaProperty

MultiSelectProperty

PhoneNumberProperty

RollupProperty

TitleProperty

CreatedByProperty

EmailProperty

LastEditedByProperty

NumberProperty

RelationProperty 🚧

SelectProperty

UrlProperty

CreatedTimeProperty

FilesProperty

LastEditedTimeProperty

PeopleProperty

RichTextProperty

StatusProperty

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

[DB/DS] add_multi_select_option(name: a_name, color: a_color) → Array<Hash>

  1. add_multi_select_option adds a multi_select option to Database / DataSource property schema.

  2. add_multi_select_option marks the property as updated and returns the updated option array.

  3. add_multi_select_option of Page property raises StandardError.

    page.properties["MultiSelectTitle"].add_multi_select_option name: "a_name", color: "green"
    # => in `assert_database_or_data_source_property': add_multi_select_option can execute only Database or DataSource property. (StandardError)
    
    ds.properties["MultiSelectTitle"].add_multi_select_option name: "a_name", color: "green"
    # => 
    # [{"id"=>"2a0eeeee-b3fd-4072-96a9-865f67cfa6ff", "name"=>"Multi Select 1", "color"=>"yellow"},
    #  {"id"=>"5f554552-b77a-474b-b5c7-4ae819966e32", "name"=>"Multi Select 2", "color"=>"default"},
    #  {"id"=>"d4bc3d6e-a6e1-4d57-af66-d8ecbbda1dd3", "name"=>"multi_select", "color"=>"red"},
    #  {"name"=>"a_name", "color"=>"green"}]
    

filter_contains(value) → Query

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(value) → Query

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_does_not_contain(value) → Query

filter_is_not_empty → Query

filter_is_not_empty creates a Query object for is_not_empty filter.

ds.properties["CreatedByTitle"].filter_is_not_empty
=> #<NotionRubyMapping::Query:0x00000001104b7290 @filter={"property"=>"CreatedByTitle", "created_by"=>{"is_not_empty"=>true}}, @page_size=100, @sort=[], @start_cursor=nil>↑ Table of Contents 

multi_select → Array<Hash>, Hash

  1. multi_select of Page property returns the raw multi_select array of the page property.

  2. multi_select of Database / DataSource property returns the raw multi_select schema object.

    page.properties["MultiSelectTitle"].multi_select
    # => [{"id"=>"5f554552-b77a-474b-b5c7-4ae819966e32", "name"=>"Multi Select 2", "color"=>"default"}]
    
    ds.properties["MultiSelectTitle"].multi_select
    # => 
    # {"options"=>
    #   [{"id"=>"2a0eeeee-b3fd-4072-96a9-865f67cfa6ff", "name"=>"Multi Select 1", "color"=>"yellow"},
    #    {"id"=>"5f554552-b77a-474b-b5c7-4ae819966e32", "name"=>"Multi Select 2", "color"=>"default"},
    #    {"id"=>"d4bc3d6e-a6e1-4d57-af66-d8ecbbda1dd3", "name"=>"multi_select", "color"=>"red"}]}
    

[P] multi_select=(multi_select) → Array<Hash>

  1. multi_select= of Page property sets multi_select values by option name.
  2. A String is converted into one option object.