Class: Samsara::Types::AlertObjectTrailerResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::AlertObjectTrailerResponseBody
- Defined in:
- lib/samsara_api/types/alert_object_trailer_response_body.rb
Overview
A trailer associated with the alert
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#attributes ⇒ Array<Samsara::Types::GoaAttributeTinyResponseBody>
readonly
List of attributes associated with the entity.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
-
#id ⇒ Object
readonly
created.
-
#name ⇒ Object
readonly
set or updated through the Samsara Dashboard or through the API at any time.
-
#tags ⇒ Object
readonly
associated with the Trailer.
-
#trailer_serial_number ⇒ String
readonly
The serial number of the trailer.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::AlertObjectTrailerResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(attributes: OMIT, external_ids: OMIT, id:, name: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectTrailerResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(attributes: OMIT, external_ids: OMIT, id:, name: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectTrailerResponseBody
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 51 def initialize(attributes: OMIT, external_ids: OMIT, id:, name: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) @attributes = attributes if attributes != OMIT @external_ids = external_ids if external_ids != OMIT @id = id @name = name if name != OMIT @tags = if != OMIT @trailer_serial_number = trailer_serial_number if trailer_serial_number != OMIT @additional_properties = additional_properties @_field_set = { "attributes": attributes, "externalIds": external_ids, "id": id, "name": name, "tags": , "trailerSerialNumber": trailer_serial_number }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 30 def additional_properties @additional_properties end |
#attributes ⇒ Array<Samsara::Types::GoaAttributeTinyResponseBody> (readonly)
Returns List of attributes associated with the entity.
12 13 14 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 12 def attributes @attributes end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
14 15 16 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 14 def external_ids @external_ids end |
#id ⇒ Object (readonly)
created. It cannot be changed.
17 18 19 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 17 def id @id end |
#name ⇒ Object (readonly)
set or updated through the Samsara Dashboard or through the API at any time.
22 23 24 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 22 def name @name end |
#tags ⇒ Object (readonly)
associated with the Trailer.
26 27 28 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 26 def @tags end |
#trailer_serial_number ⇒ String (readonly)
Returns The serial number of the trailer.
28 29 30 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 28 def trailer_serial_number @trailer_serial_number end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertObjectTrailerResponseBody
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 67 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) attributes = parsed_json["attributes"]&.map do | item | item = item.to_json Samsara::Types::GoaAttributeTinyResponseBody.from_json(json_object: item) end external_ids = parsed_json["externalIds"] id = parsed_json["id"] name = parsed_json["name"] = parsed_json["tags"]&.map do | item | item = item.to_json Samsara::Types::GoaTagTinyResponseResponseBody.from_json(json_object: item) end trailer_serial_number = parsed_json["trailerSerialNumber"] new( attributes: attributes, external_ids: external_ids, id: id, name: name, tags: , trailer_serial_number: trailer_serial_number, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
104 105 106 107 108 109 110 111 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 104 def self.validate_raw(obj:) obj.attributes&.is_a?(Array) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.") obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.") obj.trailer_serial_number&.is_a?(String) != false || raise("Passed value for field obj.trailer_serial_number is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
95 96 97 |
# File 'lib/samsara_api/types/alert_object_trailer_response_body.rb', line 95 def to_json @_field_set&.to_json end |