Class: NotionRubyMapping::DateBaseProperty

Inherits:
Property
  • Object
show all
Includes:
IsEmptyIsNotEmpty
Defined in:
lib/notion_ruby_mapping/date_base_property.rb

Overview

Date base property (date, created_time, last_edited_time)

Instance Attribute Summary

Attributes inherited from Property

#name, #will_update

Instance Method Summary collapse

Methods included from IsEmptyIsNotEmpty

#filter_is_empty, #filter_is_not_empty

Methods inherited from Property

create_from_json, #initialize, #make_filter_query, #type

Constructor Details

This class inherits a constructor from NotionRubyMapping::Property

Instance Method Details

#filter_after(value) ⇒ Object



37
38
39
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 37

def filter_after(value)
  make_filter_query "after", value_str(value)
end

#filter_before(value) ⇒ Object



33
34
35
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 33

def filter_before(value)
  make_filter_query "before", value_str(value)
end

#filter_does_not_equal(value) ⇒ Object



29
30
31
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 29

def filter_does_not_equal(value)
  make_filter_query "does_not_equal", value_str(value)
end

#filter_equals(value) ⇒ Object



25
26
27
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 25

def filter_equals(value)
  make_filter_query "equals", value_str(value)
end

#filter_next_monthObject



65
66
67
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 65

def filter_next_month
  make_filter_query "next_month", {}
end

#filter_next_weekObject



61
62
63
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 61

def filter_next_week
  make_filter_query "next_week", {}
end

#filter_next_yearObject



69
70
71
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 69

def filter_next_year
  make_filter_query "next_year", {}
end

#filter_on_or_after(value) ⇒ Object



45
46
47
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 45

def filter_on_or_after(value)
  make_filter_query "on_or_after", value_str(value)
end

#filter_on_or_before(value) ⇒ Object



41
42
43
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 41

def filter_on_or_before(value)
  make_filter_query "on_or_before", value_str(value)
end

#filter_past_monthObject



53
54
55
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 53

def filter_past_month
  make_filter_query "past_month", {}
end

#filter_past_weekObject



49
50
51
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 49

def filter_past_week
  make_filter_query "past_week", {}
end

#filter_past_yearObject



57
58
59
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 57

def filter_past_year
  make_filter_query "past_year", {}
end

#value_str(obj) ⇒ String

Returns iso8601 format string.

Parameters:

  • obj (Date, Time, DateTime, String, nil)

Returns:

  • (String)

    iso8601 format string



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/notion_ruby_mapping/date_base_property.rb', line 12

def 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