Class: Samsara::Types::VehicleResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleResponseResponseBody
- Defined in:
- lib/samsara_api/types/vehicle_response_response_body.rb
Overview
A vehicle object
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.
-
#id ⇒ String
readonly
ID of the vehicle.
-
#license_plate ⇒ String
readonly
The license plate of the vehicle.
-
#name ⇒ String
readonly
Name of the vehicle.
-
#vehicle_vin ⇒ String
readonly
The VIN of the vehicle.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(asset_type: OMIT, external_ids: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vehicle_vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(asset_type: OMIT, external_ids: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vehicle_vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleResponseResponseBody
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 40 def initialize(asset_type: OMIT, external_ids: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vehicle_vin: OMIT, additional_properties: nil) @asset_type = asset_type if asset_type != OMIT @external_ids = external_ids if external_ids != OMIT @id = id if id != OMIT @license_plate = license_plate if license_plate != OMIT @name = name if name != OMIT @vehicle_vin = vehicle_vin if vehicle_vin != OMIT @additional_properties = additional_properties @_field_set = { "assetType": asset_type, "externalIds": external_ids, "id": id, "licensePlate": license_plate, "name": name, "vehicleVin": vehicle_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.
24 25 26 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 24 def additional_properties @additional_properties end |
#asset_type ⇒ Object (readonly)
‘unpowered`, `vehicle`
12 13 14 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 12 def asset_type @asset_type end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
14 15 16 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 14 def external_ids @external_ids end |
#id ⇒ String (readonly)
Returns ID of the vehicle.
16 17 18 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 16 def id @id end |
#license_plate ⇒ String (readonly)
Returns The license plate of the vehicle.
18 19 20 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 18 def license_plate @license_plate end |
#name ⇒ String (readonly)
Returns Name of the vehicle.
20 21 22 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 20 def name @name end |
#vehicle_vin ⇒ String (readonly)
Returns The VIN of the vehicle.
22 23 24 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 22 def vehicle_vin @vehicle_vin end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleResponseResponseBody
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 56 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"] id = parsed_json["id"] license_plate = parsed_json["licensePlate"] name = parsed_json["name"] vehicle_vin = parsed_json["vehicleVin"] new( asset_type: asset_type, external_ids: external_ids, id: id, license_plate: license_plate, name: name, vehicle_vin: vehicle_vin, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
87 88 89 90 91 92 93 94 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 87 def self.validate_raw(obj:) obj.asset_type&.is_a?(Samsara::Types::VehicleResponseResponseBodyAssetType) != 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.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.vehicle_vin&.is_a?(String) != false || raise("Passed value for field obj.vehicle_vin is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
78 79 80 |
# File 'lib/samsara_api/types/vehicle_response_response_body.rb', line 78 def to_json @_field_set&.to_json end |