Class: NotionRubyMapping::CheckboxProperty
- Includes:
- EqualsDoesNotEqual
- Defined in:
- lib/notion_ruby_mapping/properties/checkbox_property.rb
Overview
Checkbox property
Constant Summary collapse
- TYPE =
"checkbox"
Instance Attribute Summary
Attributes inherited from Property
#name, #property_cache, #property_id, #will_update
Instance Method Summary collapse
- #checkbox ⇒ Boolean, ...
-
#checkbox=(flag) ⇒ TrueClass, FalseClass
Settled value.
-
#initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: nil) ⇒ CheckboxProperty
constructor
A new instance of CheckboxProperty.
- #property_values_json ⇒ Hash
Methods included from EqualsDoesNotEqual
#filter_does_not_equal, #filter_equals
Methods inherited from Property
#assert_database_property, #assert_page_property, #clear_will_update, #contents?, create_from_json, #database?, #make_filter_query, #new_name=, #page?, #property_schema_json, #remove, #retrieve_page_property, #type, #update_from_json, #update_property_schema_json
Constructor Details
#initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: nil) ⇒ CheckboxProperty
Returns a new instance of CheckboxProperty.
36 37 38 39 40 41 42 43 44 |
# File 'lib/notion_ruby_mapping/properties/checkbox_property.rb', line 36 def initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: nil) super name, will_update: will_update, base_type: base_type, property_id: property_id, property_cache: property_cache @json = if database? json || {} else json || false end end |
Instance Method Details
#checkbox ⇒ Boolean, ...
15 16 17 |
# File 'lib/notion_ruby_mapping/properties/checkbox_property.rb', line 15 def checkbox @json end |
#checkbox=(flag) ⇒ TrueClass, FalseClass
Returns settled value.
24 25 26 27 28 |
# File 'lib/notion_ruby_mapping/properties/checkbox_property.rb', line 24 def checkbox=(flag) assert_page_property __method__ @will_update = true @json = flag end |
#property_values_json ⇒ Hash
49 50 51 52 |
# File 'lib/notion_ruby_mapping/properties/checkbox_property.rb', line 49 def property_values_json assert_page_property __method__ {@name => {"checkbox" => @json, "type" => "checkbox"}} end |