Class: NotionRubyMapping::RollupProperty
- Inherits:
-
DateBaseProperty
- Object
- Property
- DateBaseProperty
- NotionRubyMapping::RollupProperty
- Defined in:
- lib/notion_ruby_mapping/properties/rollup_property.rb
Overview
Rollup property
Constant Summary collapse
- TYPE =
"rollup"
Instance Attribute Summary
Attributes inherited from Property
#name, #property_cache, #property_id, #will_update
Instance Method Summary collapse
-
#function ⇒ String
New or settled function.
- #function=(func) ⇒ Object
-
#initialize(name, will_update: false, json: nil, base_type: "page", property_id: nil, property_cache: nil, query: nil) ⇒ RollupProperty
constructor
A new instance of RollupProperty.
-
#property_values_json ⇒ Object
Page property only methods.
-
#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
date_from_obj, #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, #filter_this_week, start_end_time, value_str, #value_str
Methods included from IsEmptyIsNotEmpty
#filter_is_empty, #filter_is_not_empty
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
Constructor Details
#initialize(name, will_update: false, json: nil, base_type: "page", property_id: nil, property_cache: nil, query: nil) ⇒ RollupProperty
Returns a new instance of RollupProperty.
74 75 76 77 78 79 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 74 def initialize(name, will_update: false, json: nil, base_type: "page", property_id: nil, property_cache: nil, query: nil) super name, will_update: will_update, base_type: base_type, property_id: property_id, property_cache: property_cache, query: query @json = json || {} end |
Instance Method Details
#function ⇒ String
Returns new or settled function.
25 26 27 28 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 25 def function assert_database_property __method__ @json["function"] end |
#function=(func) ⇒ Object
32 33 34 35 36 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 32 def function=(func) assert_database_property __method__ @will_update = true @json["function"] = func end |
#property_values_json ⇒ Object
Page property only methods
99 100 101 102 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 99 def property_values_json assert_page_property __method__ {} end |
#relation_property_name ⇒ String
Returns new or settled relation_property_name.
40 41 42 43 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 40 def relation_property_name assert_database_property __method__ @json["relation_property_name"] end |
#relation_property_name=(rpn) ⇒ Object
47 48 49 50 51 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 47 def relation_property_name=(rpn) assert_database_property __method__ @will_update = true @json["relation_property_name"] = rpn end |
#rollup ⇒ Hash
17 18 19 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 17 def rollup @json end |
#rollup_property_name ⇒ String
Returns new or settled rollup_property_name.
55 56 57 58 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 55 def rollup_property_name assert_database_property __method__ @json["rollup_property_name"] end |
#rollup_property_name=(rpn) ⇒ Object
62 63 64 65 66 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 62 def rollup_property_name=(rpn) assert_database_property __method__ @will_update = true @json["rollup_property_name"] = rpn end |
#update_property_schema_json ⇒ Hash
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/notion_ruby_mapping/properties/rollup_property.rb', line 84 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 |