Class: Samsara::Types::VehicleWithGatewayTinyResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleWithGatewayTinyResponseResponseBody
- Defined in:
- lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb
Overview
assigned to the vehicle.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#asset_type ⇒ Object
readonly
‘unpowered`, `vehicle`.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
- #gateway ⇒ Samsara::Types::GoaGatewayTinyResponseResponseBody readonly
-
#id ⇒ String
readonly
ID of the vehicle.
-
#license_plate ⇒ String
readonly
The license plate of the vehicle.
-
#name ⇒ String
readonly
Name of the vehicle.
-
#vin ⇒ String
readonly
The VIN of the vehicle.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(asset_type: OMIT, external_ids: OMIT, gateway: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(asset_type: OMIT, external_ids: OMIT, gateway: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 45 def initialize(asset_type: OMIT, external_ids: OMIT, gateway: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vin: OMIT, additional_properties: nil) @asset_type = asset_type if asset_type != OMIT @external_ids = external_ids if external_ids != OMIT @gateway = gateway if gateway != OMIT @id = id if id != OMIT @license_plate = license_plate if license_plate != OMIT @name = name if name != OMIT @vin = vin if vin != OMIT @additional_properties = additional_properties @_field_set = { "assetType": asset_type, "externalIds": external_ids, "gateway": gateway, "id": id, "licensePlate": license_plate, "name": name, "vin": vin }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 28 def additional_properties @additional_properties end |
#asset_type ⇒ Object (readonly)
‘unpowered`, `vehicle`
14 15 16 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 14 def asset_type @asset_type end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
16 17 18 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 16 def external_ids @external_ids end |
#gateway ⇒ Samsara::Types::GoaGatewayTinyResponseResponseBody (readonly)
18 19 20 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 18 def gateway @gateway end |
#id ⇒ String (readonly)
Returns ID of the vehicle.
20 21 22 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 20 def id @id end |
#license_plate ⇒ String (readonly)
Returns The license plate of the vehicle.
22 23 24 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 22 def license_plate @license_plate end |
#name ⇒ String (readonly)
Returns Name of the vehicle.
24 25 26 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 24 def name @name end |
#vin ⇒ String (readonly)
Returns The VIN of the vehicle.
26 27 28 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 26 def vin @vin end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 63 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) asset_type = parsed_json["assetType"] external_ids = parsed_json["externalIds"] unless parsed_json["gateway"].nil? gateway = parsed_json["gateway"].to_json gateway = Samsara::Types::GoaGatewayTinyResponseResponseBody.from_json(json_object: gateway) else gateway = nil end id = parsed_json["id"] license_plate = parsed_json["licensePlate"] name = parsed_json["name"] vin = parsed_json["vin"] new( asset_type: asset_type, external_ids: external_ids, gateway: gateway, id: id, license_plate: license_plate, name: name, vin: vin, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
102 103 104 105 106 107 108 109 110 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 102 def self.validate_raw(obj:) obj.asset_type&.is_a?(Samsara::Types::VehicleWithGatewayTinyResponseResponseBodyAssetType) != false || raise("Passed value for field obj.asset_type 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.gateway.nil? || Samsara::Types::GoaGatewayTinyResponseResponseBody.validate_raw(obj: obj.gateway) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") 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.vin&.is_a?(String) != false || raise("Passed value for field obj.vin is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
93 94 95 |
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 93 def to_json @_field_set&.to_json end |