Class: NotionRubyMapping::RollupProperty
- Inherits:
-
DateBaseProperty
- Object
- Property
- DateBaseProperty
- NotionRubyMapping::RollupProperty
- Defined in:
- lib/notion_ruby_mapping/rollup_property.rb
Overview
Rollup property
Constant Summary collapse
- TYPE =
"rollup"
Instance Attribute Summary
Attributes inherited from Property
Instance Method Summary collapse
-
#function ⇒ String
New or settled function.
- #function=(func) ⇒ Object
-
#initialize(name, will_update: false, json: nil, base_type: :page) ⇒ RollupProperty
constructor
A new instance of RollupProperty.
-
#relation_property_name ⇒ String
New or settled relation_property_name.
- #relation_property_name=(rpn) ⇒ Object
- #rollup ⇒ Hash
-
#rollup_property_name ⇒ String
New or settled rollup_property_name.
- #rollup_property_name=(rpn) ⇒ Object
- #update_property_schema_json ⇒ Hash
Methods included from GreaterThanLessThan
#filter_greater_than, #filter_greater_than_or_equal_to, #filter_less_than, #filter_less_than_or_equal_to
Methods included from StartsWithEndsWith
#filter_ends_with, #filter_starts_with
Methods included from ContainsDoesNotContain
#filter_contains, #filter_does_not_contain
Methods inherited from DateBaseProperty
#filter_after, #filter_before, #filter_does_not_equal, #filter_equals, #filter_next_month, #filter_next_week, #filter_next_year, #filter_on_or_after, #filter_on_or_before, #filter_past_month, #filter_past_week, #filter_past_year
Methods included from IsEmptyIsNotEmpty
#filter_is_empty, #filter_is_not_empty
Methods inherited from Property
#assert_database_property, #assert_page_property, #clear_will_update, create_from_json, #database?, #make_filter_query, #new_name=, #page?, #property_schema_json, #property_values_json, #remove, #type, #update_from_json
Constructor Details
#initialize(name, will_update: false, json: nil, base_type: :page) ⇒ RollupProperty
Returns a new instance of RollupProperty.
67 68 69 70 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 67 def initialize(name, will_update: false, json: nil, base_type: :page) super name, will_update: will_update, base_type: base_type @json = json || {} end |
Instance Method Details
#function ⇒ String
Returns new or settled function.
23 24 25 26 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 23 def function assert_database_property __method__ @json["function"] end |
#function=(func) ⇒ Object
29 30 31 32 33 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 29 def function=(func) assert_database_property __method__ @will_update = true @json["function"] = func end |
#relation_property_name ⇒ String
Returns new or settled relation_property_name.
36 37 38 39 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 36 def relation_property_name assert_database_property __method__ @json["relation_property_name"] end |
#relation_property_name=(rpn) ⇒ Object
42 43 44 45 46 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 42 def relation_property_name=(rpn) assert_database_property __method__ @will_update = true @json["relation_property_name"] = rpn end |
#rollup ⇒ Hash
16 17 18 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 16 def rollup @json end |
#rollup_property_name ⇒ String
Returns new or settled rollup_property_name.
49 50 51 52 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 49 def rollup_property_name assert_database_property __method__ @json["rollup_property_name"] end |
#rollup_property_name=(rpn) ⇒ Object
55 56 57 58 59 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 55 def rollup_property_name=(rpn) assert_database_property __method__ @will_update = true @json["rollup_property_name"] = rpn end |
#update_property_schema_json ⇒ Hash
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/notion_ruby_mapping/rollup_property.rb', line 75 def update_property_schema_json assert_database_property __method__ ans = super return ans if ans != {} || !@will_update ans[@name] ||= {} ans[@name]["rollup"] ||= {} ans[@name]["rollup"]["function"] = function ans[@name]["rollup"]["relation_property_name"] = relation_property_name ans[@name]["rollup"]["rollup_property_name"] = rollup_property_name ans end |