Class: WhatsAppCloudApi::DateTimeObject
- Defined in:
- lib/whats_app_cloud_api/models/date_time_object.rb
Overview
DateTimeObject Model.
Instance Attribute Summary collapse
-
#calendar ⇒ String
Default text.
-
#day_of_month ⇒ Integer
Default text.
-
#day_of_week ⇒ Integer
Default text.
-
#fallback_value ⇒ String
Default text.
-
#hour ⇒ Integer
Default text.
-
#minute ⇒ Integer
Default text.
-
#month ⇒ Integer
Default text.
-
#year ⇒ Integer
Default text.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(fallback_value = nil, day_of_week = nil, year = nil, month = nil, day_of_month = nil, hour = nil, minute = nil, calendar = nil) ⇒ DateTimeObject
constructor
A new instance of DateTimeObject.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(fallback_value = nil, day_of_week = nil, year = nil, month = nil, day_of_month = nil, hour = nil, minute = nil, calendar = nil) ⇒ DateTimeObject
Returns a new instance of DateTimeObject.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 84 def initialize(fallback_value = nil, day_of_week = nil, year = nil, month = nil, day_of_month = nil, hour = nil, minute = nil, calendar = nil) @fallback_value = fallback_value unless fallback_value == SKIP @day_of_week = day_of_week unless day_of_week == SKIP @year = year unless year == SKIP @month = month unless month == SKIP @day_of_month = day_of_month unless day_of_month == SKIP @hour = hour unless hour == SKIP @minute = minute unless minute == SKIP @calendar = calendar unless calendar == SKIP end |
Instance Attribute Details
#calendar ⇒ String
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
50 51 52 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 50 def calendar @calendar end |
#day_of_month ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
35 36 37 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 35 def day_of_month @day_of_month end |
#day_of_week ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
20 21 22 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 20 def day_of_week @day_of_week end |
#fallback_value ⇒ String
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
15 16 17 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 15 def fallback_value @fallback_value end |
#hour ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
40 41 42 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 40 def hour @hour end |
#minute ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
45 46 47 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 45 def minute @minute end |
#month ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
30 31 32 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 30 def month @month end |
#year ⇒ Integer
Default text. For Cloud API, we always use the fallback value, and we do not attempt to localize using other optional fields.
25 26 27 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 25 def year @year end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 103 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. fallback_value = hash.key?('fallback_value') ? hash['fallback_value'] : SKIP day_of_week = hash.key?('day_of_week') ? hash['day_of_week'] : SKIP year = hash.key?('year') ? hash['year'] : SKIP month = hash.key?('month') ? hash['month'] : SKIP day_of_month = hash.key?('day_of_month') ? hash['day_of_month'] : SKIP hour = hash.key?('hour') ? hash['hour'] : SKIP minute = hash.key?('minute') ? hash['minute'] : SKIP calendar = hash.key?('calendar') ? hash['calendar'] : SKIP # Create object from extracted values. DateTimeObject.new(fallback_value, day_of_week, year, month, day_of_month, hour, minute, calendar) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['fallback_value'] = 'fallback_value' @_hash['day_of_week'] = 'day_of_week' @_hash['year'] = 'year' @_hash['month'] = 'month' @_hash['day_of_month'] = 'day_of_month' @_hash['hour'] = 'hour' @_hash['minute'] = 'minute' @_hash['calendar'] = 'calendar' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
80 81 82 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 80 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/whats_app_cloud_api/models/date_time_object.rb', line 67 def optionals %w[ day_of_week year month day_of_month hour minute calendar ] end |