Class: NotionRubyMapping::FormulaProperty
- Inherits:
-
DateBaseProperty
- Object
- Property
- DateBaseProperty
- NotionRubyMapping::FormulaProperty
- Defined in:
- lib/notion_ruby_mapping/formula_property.rb
Overview
Formula property
Constant Summary collapse
- TYPE =
"formula"
Instance Attribute Summary
Attributes inherited from Property
Instance Method Summary collapse
- #formula ⇒ Hash
-
#formula_expression ⇒ Object
Database property only methods.
- #formula_expression=(f_e) ⇒ Object
-
#initialize(name, will_update: false, base_type: :page, json: nil, formula: nil) ⇒ FormulaProperty
constructor
A new instance of FormulaProperty.
- #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, base_type: :page, json: nil, formula: nil) ⇒ FormulaProperty
Returns a new instance of FormulaProperty.
40 41 42 43 44 45 46 |
# File 'lib/notion_ruby_mapping/formula_property.rb', line 40 def initialize(name, will_update: false, base_type: :page, json: nil, formula: nil) super name, will_update: will_update, base_type: base_type @json = json || {} return unless database? @json["expression"] = formula if formula end |
Instance Method Details
#formula ⇒ Hash
16 17 18 |
# File 'lib/notion_ruby_mapping/formula_property.rb', line 16 def formula @json end |
#formula_expression ⇒ Object
Database property only methods
22 23 24 25 |
# File 'lib/notion_ruby_mapping/formula_property.rb', line 22 def formula_expression assert_database_property __method__ @json["expression"] end |
#formula_expression=(f_e) ⇒ Object
28 29 30 31 32 |
# File 'lib/notion_ruby_mapping/formula_property.rb', line 28 def formula_expression=(f_e) assert_database_property __method__ @will_update = true @json["expression"] = f_e end |
#update_property_schema_json ⇒ Hash
51 52 53 54 55 56 57 58 59 |
# File 'lib/notion_ruby_mapping/formula_property.rb', line 51 def update_property_schema_json assert_database_property __method__ ans = super return ans if ans != {} || !@will_update ans[@name] ||= {} ans[@name]["formula"] = @json ans end |