Class: NotionRubyMapping::DateBaseProperty
- Includes:
- IsEmptyIsNotEmpty
- Defined in:
- lib/notion_ruby_mapping/properties/date_base_property.rb
Overview
Date base property (date, created_time, last_edited_time, formula)
Direct Known Subclasses
CreatedTimeProperty, DateProperty, FormulaProperty, LastEditedTimeProperty, RollupProperty
Instance Attribute Summary
Attributes inherited from Property
Class Method Summary collapse
-
.date_from_obj(obj) ⇒ Date?
Iso8601 format string.
-
.value_str(obj) ⇒ String?
Iso8601 format string.
Instance Method Summary collapse
-
#filter_after(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_before(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_does_not_equal(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_equals(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_next_month(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_next_week(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_next_year(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_on_or_after(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_on_or_before(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_past_month(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_past_week(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
-
#filter_past_year(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Generated Query object.
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?, #initialize, #make_filter_query, #new_name=, #page?, #property_schema_json, #property_values_json, #remove, #type, #update_from_json, #update_property_schema_json
Constructor Details
This class inherits a constructor from NotionRubyMapping::Property
Class Method Details
.date_from_obj(obj) ⇒ Date?
Returns iso8601 format string.
27 28 29 30 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 27 def self.date_from_obj(obj) str = value_str obj Date.parse str if str end |
.value_str(obj) ⇒ String?
Returns iso8601 format string.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 12 def self.value_str(obj) case obj when Date obj.iso8601 when Time obj.strftime("%Y-%m-%dT%H:%M:%S%:z") when DateTime obj.iso8601 else obj end end |
Instance Method Details
#filter_after(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
59 60 61 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 59 def filter_after(date, rollup = nil, rollup_type = nil) make_filter_query "after", value_str(date), rollup, rollup_type end |
#filter_before(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
51 52 53 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 51 def filter_before(date, rollup = nil, rollup_type = nil) make_filter_query "before", value_str(date), rollup, rollup_type end |
#filter_does_not_equal(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
43 44 45 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 43 def filter_does_not_equal(date, rollup = nil, rollup_type = nil) make_filter_query "does_not_equal", value_str(date), rollup, rollup_type end |
#filter_equals(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
36 37 38 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 36 def filter_equals(date, rollup = nil, rollup_type = nil) make_filter_query "equals", value_str(date), rollup, rollup_type end |
#filter_next_month(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
115 116 117 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 115 def filter_next_month(rollup = nil, rollup_type = nil) make_filter_query "next_month", {}, rollup, rollup_type end |
#filter_next_week(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
107 108 109 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 107 def filter_next_week(rollup = nil, rollup_type = nil) make_filter_query "next_week", {}, rollup, rollup_type end |
#filter_next_year(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
123 124 125 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 123 def filter_next_year(rollup = nil, rollup_type = nil) make_filter_query "next_year", {}, rollup, rollup_type end |
#filter_on_or_after(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
75 76 77 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 75 def filter_on_or_after(date, rollup = nil, rollup_type = nil) make_filter_query "on_or_after", value_str(date), rollup, rollup_type end |
#filter_on_or_before(date, rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
67 68 69 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 67 def filter_on_or_before(date, rollup = nil, rollup_type = nil) make_filter_query "on_or_before", value_str(date), rollup, rollup_type end |
#filter_past_month(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
91 92 93 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 91 def filter_past_month(rollup = nil, rollup_type = nil) make_filter_query "past_month", {}, rollup, rollup_type end |
#filter_past_week(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
83 84 85 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 83 def filter_past_week(rollup = nil, rollup_type = nil) make_filter_query "past_week", {}, rollup, rollup_type end |
#filter_past_year(rollup = nil, rollup_type = nil) ⇒ NotionRubyMapping::Query
Returns generated Query object.
99 100 101 |
# File 'lib/notion_ruby_mapping/properties/date_base_property.rb', line 99 def filter_past_year(rollup = nil, rollup_type = nil) make_filter_query "past_year", {}, rollup, rollup_type end |