<aside> 👉 Links (Property base class)
Notion Ruby Mapping Public API Reference
</aside>
add_select_option adds a select option to Database / DataSource property schema.
add_select_option marks the property as updated and returns the updated option array.
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"}]
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.
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"}}
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"}}
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}}