Class: Samsara::Types::TinyAssetObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::TinyAssetObjectResponseBody
- Defined in:
- lib/samsara_api/types/tiny_asset_object_response_body.rb
Overview
Vehicle, trailer or other equipment to be tracked.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#asset_id ⇒ String
readonly
ID of the asset.
-
#asset_type ⇒ Object
readonly
‘trailer`, `equipment`, `unpowered`, `vehicle`.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(asset_id:, asset_type:, additional_properties: nil) ⇒ Samsara::Types::TinyAssetObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(asset_id:, asset_type:, additional_properties: nil) ⇒ Samsara::Types::TinyAssetObjectResponseBody
34 35 36 37 38 39 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 34 def initialize(asset_id:, asset_type:, additional_properties: nil) @asset_id = asset_id @asset_type = asset_type @additional_properties = additional_properties @_field_set = { "assetId": asset_id, "assetType": asset_type } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 19 def additional_properties @additional_properties end |
#asset_id ⇒ String (readonly)
Returns ID of the asset.
11 12 13 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 11 def asset_id @asset_id end |
#asset_type ⇒ Object (readonly)
‘trailer`, `equipment`, `unpowered`, `vehicle`
17 18 19 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 17 def asset_type @asset_type end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TinyAssetObjectResponseBody
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) asset_id = parsed_json["assetId"] asset_type = parsed_json["assetType"] new( asset_id: asset_id, asset_type: asset_type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
67 68 69 70 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 67 def self.validate_raw(obj:) obj.asset_id.is_a?(String) != false || raise("Passed value for field obj.asset_id is not the expected type, validation failed.") obj.asset_type.is_a?(Samsara::Types::TinyAssetObjectResponseBodyAssetType) != false || raise("Passed value for field obj.asset_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
58 59 60 |
# File 'lib/samsara_api/types/tiny_asset_object_response_body.rb', line 58 def to_json @_field_set&.to_json end |