Class: GoogleMapsPlatform::TimeZoneTextValueObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::TimeZoneTextValueObject
- Defined in:
- lib/google_maps_platform/models/time_zone_text_value_object.rb
Overview
An object containing Unix time, a time zone, and its formatted text representation.
Instance Attribute Summary collapse
-
#text ⇒ String
The time specified as a string in the time zone.
-
#time_zone ⇒ String
Contains the time zone.
-
#value ⇒ Float
The time specified as Unix time, or seconds since midnight, January 1, 1970 UTC.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(text:, value:, time_zone:, additional_properties: nil) ⇒ TimeZoneTextValueObject
constructor
A new instance of TimeZoneTextValueObject.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(text:, value:, time_zone:, additional_properties: nil) ⇒ TimeZoneTextValueObject
Returns a new instance of TimeZoneTextValueObject.
47 48 49 50 51 52 53 54 55 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 47 def initialize(text:, value:, time_zone:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @text = text @value = value @time_zone = time_zone @additional_properties = additional_properties end |
Instance Attribute Details
#text ⇒ String
The time specified as a string in the time zone.
15 16 17 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 15 def text @text end |
#time_zone ⇒ String
Contains the time zone. The value is the name of the time zone as defined in the [IANA Time Zone Database](www.iana.org/time-zones), e.g. “America/New_York”.
26 27 28 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 26 def time_zone @time_zone end |
#value ⇒ Float
The time specified as Unix time, or seconds since midnight, January 1, 1970 UTC.
20 21 22 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 20 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 58 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. text = hash.key?('text') ? hash['text'] : nil value = hash.key?('value') ? hash['value'] : nil time_zone = hash.key?('time_zone') ? hash['time_zone'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. TimeZoneTextValueObject.new(text: text, value: value, time_zone: time_zone, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['text'] = 'text' @_hash['value'] = 'value' @_hash['time_zone'] = 'time_zone' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 38 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
88 89 90 91 92 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 88 def inspect class_name = self.class.name.split('::').last "<#{class_name} text: #{@text.inspect}, value: #{@value.inspect}, time_zone:"\ " #{@time_zone.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 85 |
# File 'lib/google_maps_platform/models/time_zone_text_value_object.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} text: #{@text}, value: #{@value}, time_zone: #{@time_zone},"\ " additional_properties: #{@additional_properties}>" end |