<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>

1. Instance methods

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

  1. add_select_option adds a select option to Database / DataSource property schema.

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

  3. add_select_option of Page property raises StandardError.

    page.properties["SelectTitle"].add_select_option name: "a_name", color: "green"
    # => in `assert_database_or_data_source_property': add_select_option can execute only Database or DataSource property. (StandardError)
    
    ds.properties["SelectTitle"].add_select_option name: "a_name", color: "green"
    # => 
    # [{"id"=>"0fed8e50-c917-4b56-96d9-9691a5132fc4", "name"=>"Select 1", "color"=>"brown"},
    #  {"id"=>"0b71c5a8-ea82-4b21-970e-b155e7c68a7e", "name"=>"Select 2", "color"=>"default"},
    #  {"id"=>"b32c83bb-c9af-49e8-9b88-122139affdb7", "name"=>"Select 3", "color"=>"purple"},
    #  {"name"=>"a_name", "color"=>"green"}]
    

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.

The positional argument is a select option name. Omit condition: and another_type: for an ordinary select filter; they are for nested Formula / Rollup conditions. SelectProperty includes EqualsDoesNotEqual and IsEmptyIsNotEmpty only, so contains / does_not_contain filters are not available.

[DB/DS] filter_does_not_equal(value) → Query

Creates a Query object whose select condition does not match the given option name.

ds.properties["SelectTitle"].filter_does_not_equal("Select 1").filter
# => {"property" => "SelectTitle", "select" => {"does_not_equal" => "Select 1"}}

[DB/DS] filter_equals(value) → Query

Creates a Query object whose select condition matches the given option name.

ds.properties["SelectTitle"].filter_equals("Select 1").filter
# => {"property" => "SelectTitle", "select" => {"equals" => "Select 1"}}

[DB/DS] filter_is_empty → Query

Creates a Query object whose select condition matches properties that have no selected option.

ds.properties["SelectTitle"].filter_is_empty.filter
# => {"property" => "SelectTitle", "select" => {"is_empty" => true}}