Class: NotionRubyMapping::SelectProperty
- Includes:
- EqualsDoesNotEqual, IsEmptyIsNotEmpty
- Defined in:
- lib/notion_ruby_mapping/select_property.rb
Overview
Select property
Constant Summary collapse
- TYPE =
"select"
Instance Attribute Summary
Attributes inherited from Property
Instance Method Summary collapse
-
#initialize(name, will_update: false, json: nil, select: nil) ⇒ SelectProperty
constructor
A new instance of SelectProperty.
- #property_values_json ⇒ Hash
-
#select=(select) ⇒ String
Settled value.
- #update_from_json(json) ⇒ Object
Methods included from IsEmptyIsNotEmpty
#filter_is_empty, #filter_is_not_empty
Methods included from EqualsDoesNotEqual
#filter_does_not_equal, #filter_equals
Methods inherited from Property
create_from_json, #make_filter_query, #type
Constructor Details
#initialize(name, will_update: false, json: nil, select: nil) ⇒ SelectProperty
Returns a new instance of SelectProperty.
13 14 15 16 |
# File 'lib/notion_ruby_mapping/select_property.rb', line 13 def initialize(name, will_update: false, json: nil, select: nil) super name, will_update: will_update @select = select || json && json["name"] end |
Instance Method Details
#property_values_json ⇒ Hash
25 26 27 |
# File 'lib/notion_ruby_mapping/select_property.rb', line 25 def property_values_json {@name => {"type" => "select", "select" => (@select ? {"name" => @select} : @json)}} end |
#select=(select) ⇒ String
Returns settled value.
31 32 33 34 |
# File 'lib/notion_ruby_mapping/select_property.rb', line 31 def select=(select) @will_update = true @select = select end |
#update_from_json(json) ⇒ Object
19 20 21 22 |
# File 'lib/notion_ruby_mapping/select_property.rb', line 19 def update_from_json(json) @will_update = false @select = json["select"]["name"] end |