Class: Samsara::Types::TinyAssetObjectResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset_id:, asset_type:, additional_properties: nil) ⇒ Samsara::Types::TinyAssetObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_idString (readonly)

Returns ID of the asset.

Returns:

  • (String)

    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_typeObject (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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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