Class: Samsara::Types::TrailerWithAttributesResponseObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::TrailerWithAttributesResponseObjectResponseBody
- Defined in:
- lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb
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.
-
#enabled_for_mobile ⇒ Boolean
readonly
Indicates if the trailer is visible on the Samsara mobile apps.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
-
#id ⇒ Object
readonly
Trailer object is created.
- #installed_gateway ⇒ Samsara::Types::TrailerGoaGatewayTinyResponseResponseBody readonly
-
#license_plate ⇒ Object
readonly
through the Samsara Dashboard or the API at any time.
-
#name ⇒ Object
readonly
API at any time.
-
#notes ⇒ Object
readonly
updated through the Samsara Dashboard or 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::TrailerWithAttributesResponseObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(attributes: OMIT, enabled_for_mobile: OMIT, external_ids: OMIT, id:, installed_gateway: OMIT, license_plate: OMIT, name: OMIT, notes: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::TrailerWithAttributesResponseObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(attributes: OMIT, enabled_for_mobile: OMIT, external_ids: OMIT, id:, installed_gateway: OMIT, license_plate: OMIT, name: OMIT, notes: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::TrailerWithAttributesResponseObjectResponseBody
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 69 def initialize(attributes: OMIT, enabled_for_mobile: OMIT, external_ids: OMIT, id:, installed_gateway: OMIT, license_plate: OMIT, name: OMIT, notes: OMIT, tags: OMIT, trailer_serial_number: OMIT, additional_properties: nil) @attributes = attributes if attributes != OMIT @enabled_for_mobile = enabled_for_mobile if enabled_for_mobile != OMIT @external_ids = external_ids if external_ids != OMIT @id = id @installed_gateway = installed_gateway if installed_gateway != OMIT @license_plate = license_plate if license_plate != OMIT @name = name if name != OMIT @notes = notes if notes != OMIT @tags = if != OMIT @trailer_serial_number = trailer_serial_number if trailer_serial_number != OMIT @additional_properties = additional_properties @_field_set = { "attributes": attributes, "enabledForMobile": enabled_for_mobile, "externalIds": external_ids, "id": id, "installedGateway": installed_gateway, "licensePlate": license_plate, "name": name, "notes": notes, "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.
41 42 43 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 41 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/trailer_with_attributes_response_object_response_body.rb', line 12 def attributes @attributes end |
#enabled_for_mobile ⇒ Boolean (readonly)
Returns Indicates if the trailer is visible on the Samsara mobile apps.
14 15 16 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 14 def enabled_for_mobile @enabled_for_mobile end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
16 17 18 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 16 def external_ids @external_ids end |
#id ⇒ Object (readonly)
Trailer object is created. It cannot be changed.
19 20 21 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 19 def id @id end |
#installed_gateway ⇒ Samsara::Types::TrailerGoaGatewayTinyResponseResponseBody (readonly)
21 22 23 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 21 def installed_gateway @installed_gateway end |
#license_plate ⇒ Object (readonly)
through the Samsara Dashboard or the API at any time.
24 25 26 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 24 def license_plate @license_plate end |
#name ⇒ Object (readonly)
API at any time.
30 31 32 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 30 def name @name end |
#notes ⇒ Object (readonly)
updated through the Samsara Dashboard or the API at any time.
33 34 35 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 33 def notes @notes end |
#tags ⇒ Object (readonly)
associated with the Trailer.
37 38 39 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 37 def @tags end |
#trailer_serial_number ⇒ String (readonly)
Returns The serial number of the trailer.
39 40 41 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 39 def trailer_serial_number @trailer_serial_number end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TrailerWithAttributesResponseObjectResponseBody
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 90 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 enabled_for_mobile = parsed_json["enabledForMobile"] external_ids = parsed_json["externalIds"] id = parsed_json["id"] unless parsed_json["installedGateway"].nil? installed_gateway = parsed_json["installedGateway"].to_json installed_gateway = Samsara::Types::TrailerGoaGatewayTinyResponseResponseBody.from_json(json_object: installed_gateway) else installed_gateway = nil end license_plate = parsed_json["licensePlate"] name = parsed_json["name"] notes = parsed_json["notes"] = 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, enabled_for_mobile: enabled_for_mobile, external_ids: external_ids, id: id, installed_gateway: installed_gateway, license_plate: license_plate, name: name, notes: notes, tags: , trailer_serial_number: trailer_serial_number, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 141 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.enabled_for_mobile&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled_for_mobile 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.installed_gateway.nil? || Samsara::Types::TrailerGoaGatewayTinyResponseResponseBody.validate_raw(obj: obj.installed_gateway) obj.license_plate&.is_a?(String) != false || raise("Passed value for field obj.license_plate 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.notes&.is_a?(String) != false || raise("Passed value for field obj.notes 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
132 133 134 |
# File 'lib/samsara_api/types/trailer_with_attributes_response_object_response_body.rb', line 132 def to_json @_field_set&.to_json end |