Class: Samsara::Types::TripAssetResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::TripAssetResponseBody
- Defined in:
- lib/samsara_api/types/trip_asset_response_body.rb
Overview
Asset that the location readings are tied to
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
Unique ID for the asset object that is reporting the location.
-
#name ⇒ Object
readonly
‘includeAsset` is set to `true`.
-
#type ⇒ Object
readonly
‘equipment`, `unpowered`, `vehicle`.
-
#vin ⇒ Object
readonly
‘includeAsset` is set to `true`.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, name: OMIT, type: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::TripAssetResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, name: OMIT, type: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::TripAssetResponseBody
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 40 def initialize(id:, name: OMIT, type: OMIT, vin: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @type = type if type != OMIT @vin = vin if vin != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "type": type, "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.
23 24 25 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 23 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns Unique ID for the asset object that is reporting the location.
11 12 13 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 11 def id @id end |
#name ⇒ Object (readonly)
‘includeAsset` is set to `true`.
14 15 16 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 14 def name @name end |
#type ⇒ Object (readonly)
‘equipment`, `unpowered`, `vehicle`
18 19 20 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 18 def type @type end |
#vin ⇒ Object (readonly)
‘includeAsset` is set to `true`.
21 22 23 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 21 def vin @vin end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TripAssetResponseBody
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] type = parsed_json["type"] vin = parsed_json["vin"] new( id: id, name: name, type: type, vin: vin, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
81 82 83 84 85 86 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 81 def self.validate_raw(obj:) 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.type&.is_a?(Samsara::Types::TripAssetResponseBodyType) != false || raise("Passed value for field obj.type 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
72 73 74 |
# File 'lib/samsara_api/types/trip_asset_response_body.rb', line 72 def to_json @_field_set&.to_json end |