Class: Samsara::Types::TrailerResponseObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::TrailerResponseObjectResponseBody
- Defined in:
- lib/samsara_api/types/trailer_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.
-
#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::TrailerResponseObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(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::TrailerResponseObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(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::TrailerResponseObjectResponseBody
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 65 def initialize(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) @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 = if != OMIT @trailer_serial_number = trailer_serial_number if trailer_serial_number != OMIT @additional_properties = additional_properties @_field_set = { "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.
38 39 40 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 38 def additional_properties @additional_properties end |
#enabled_for_mobile ⇒ Boolean (readonly)
Returns Indicates if the trailer is visible on the Samsara mobile apps.
11 12 13 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 11 def enabled_for_mobile @enabled_for_mobile end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
13 14 15 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 13 def external_ids @external_ids end |
#id ⇒ Object (readonly)
Trailer object is created. It cannot be changed.
16 17 18 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 16 def id @id end |
#installed_gateway ⇒ Samsara::Types::TrailerGoaGatewayTinyResponseResponseBody (readonly)
18 19 20 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 18 def installed_gateway @installed_gateway end |
#license_plate ⇒ Object (readonly)
through the Samsara Dashboard or the API at any time.
21 22 23 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 21 def license_plate @license_plate end |
#name ⇒ Object (readonly)
API at any time.
27 28 29 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 27 def name @name end |
#notes ⇒ Object (readonly)
updated through the Samsara Dashboard or the API at any time.
30 31 32 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 30 def notes @notes end |
#tags ⇒ Object (readonly)
associated with the Trailer.
34 35 36 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 34 def end |
#trailer_serial_number ⇒ String (readonly)
Returns The serial number of the trailer.
36 37 38 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 36 def trailer_serial_number @trailer_serial_number end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TrailerResponseObjectResponseBody
84 85 86 87 88 89 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 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 84 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) 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( 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
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 129 def self.validate_raw(obj:) 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
120 121 122 |
# File 'lib/samsara_api/types/trailer_response_object_response_body.rb', line 120 def to_json @_field_set&.to_json end |