Module: GenesisRuby::Api::Mixins::Requests::NonFinancial::DateAttributes

Overview

Date Attributes mixin

Instance Method Summary collapse

Instance Method Details

#end_dateObject

End of the requested date range (time is optional)



28
29
30
31
32
33
34
35
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 28

def end_date
  format = if end_date_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @end_date&.strftime format
end

#end_date=(value) ⇒ Object

End of the requested date range (time is optional)



38
39
40
41
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 38

def end_date=(value)
  self.end_date_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end

#end_date_fromObject

Start of the requested date range in UTC.



76
77
78
79
80
81
82
83
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 76

def end_date_from
  format = if end_date_from_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @end_date_from&.strftime format
end

#end_date_from=(value) ⇒ Object

Start of the requested date range in UTC.



86
87
88
89
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 86

def end_date_from=(value)
  self.end_date_from_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end

#end_date_toObject

End of the requested date range in UTC.



92
93
94
95
96
97
98
99
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 92

def end_date_to
  format = if end_date_to_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @end_date_to&.strftime format
end

#end_date_to=(value) ⇒ Object

End of the requested date range in UTC.



102
103
104
105
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 102

def end_date_to=(value)
  self.end_date_to_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end

#start_dateObject

Start of the requested date range (time is optional)



12
13
14
15
16
17
18
19
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 12

def start_date
  format = if start_date_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @start_date&.strftime format
end

#start_date=(value) ⇒ Object

Start of the requested date range (time is optional)



22
23
24
25
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 22

def start_date=(value)
  self.start_date_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end

#start_date_fromObject

Start of the requested date range in UTC.



44
45
46
47
48
49
50
51
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 44

def start_date_from
  format = if start_date_from_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @start_date_from&.strftime format
end

#start_date_from=(value) ⇒ Object

Start of the requested date range in UTC.



54
55
56
57
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 54

def start_date_from=(value)
  self.start_date_from_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end

#start_date_toObject

End of the requested date range in UTC.



60
61
62
63
64
65
66
67
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 60

def start_date_to
  format = if start_date_to_time?
             Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
           else
             Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
           end
  @start_date_to&.strftime format
end

#start_date_to=(value) ⇒ Object

End of the requested date range in UTC.



70
71
72
73
# File 'lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb', line 70

def start_date_to=(value)
  self.start_date_to_time = Utils::Common.date_has_time? value
  parse_date attribute: __method__, value: value, allow_empty: true
end