<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"}]
select of Page property returns the raw select object of the page property.
select of Database / DataSource property returns the raw select schema object.
page.properties["SelectTitle"].select
# => {"id"=>"b32c83bb-c9af-49e8-9b88-122139affdb7", "name"=>"Select 3", "color"=>"purple"}
ds.properties["SelectTitle"].select
# =>
# {"options"=>
# [{"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"}]}
nilselect=(name) sets the select value of Page property by option name.
select=(nil) creates {"name"=>nil} as the current payload.
select=(name) of Database / DataSource property raises StandardError.
pp = page.properties["SelectTitle"]
pp.select = "Select 1"
pp.select
# => {"name"=>"Select 1"}
pp.select = nil
pp.select
# => {"name"=>nil}
ds.properties["SelectTitle"].select = "Select 3"
# => ... in `assert_page_property': select= can execute only Page property. (StandardError)