Class: Samsara::Types::InlineResponse2005
- Inherits:
-
Object
- Object
- Samsara::Types::InlineResponse2005
- Defined in:
- lib/samsara_api/types/inline_response_2005.rb
Overview
A list of messages.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #data ⇒ Samsara::Types::V_1_MESSAGES_RESPONSE readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(data: OMIT, additional_properties: nil) ⇒ Samsara::Types::InlineResponse2005 constructor
- #to_json ⇒ String
Constructor Details
#initialize(data: OMIT, additional_properties: nil) ⇒ Samsara::Types::InlineResponse2005
23 24 25 26 27 28 29 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 23 def initialize(data: OMIT, additional_properties: nil) @data = data if data != OMIT @additional_properties = additional_properties @_field_set = { "data": data }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
13 14 15 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 13 def additional_properties @additional_properties end |
#data ⇒ Samsara::Types::V_1_MESSAGES_RESPONSE (readonly)
11 12 13 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 11 def data @data end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::InlineResponse2005
34 35 36 37 38 39 40 41 42 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 34 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) data = parsed_json["data"]&.map do | item | item = item.to_json Samsara::Types::V1MessageResponse.from_json(json_object: item) end new(data: data, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
55 56 57 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 55 def self.validate_raw(obj:) obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
46 47 48 |
# File 'lib/samsara_api/types/inline_response_2005.rb', line 46 def to_json @_field_set&.to_json end |