Class: Samsara::Types::AssetsInputsAssetResponseResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/assets_inputs_asset_response_response_body.rb

Overview

Asset that the input data is from.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes: OMIT, external_ids: OMIT, id:, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AssetsInputsAssetResponseResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 37

def initialize(attributes: OMIT, external_ids: OMIT, id:, tags: OMIT, additional_properties: nil)
  @attributes = attributes if attributes != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @id = id
  @tags = tags if tags != OMIT
  @additional_properties = additional_properties
  @_field_set = { "attributes": attributes, "externalIds": external_ids, "id": id, "tags": tags }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 22

def additional_properties
  @additional_properties
end

#attributes ⇒ Array<Samsara::Types::GoaAttributeTinyResponseBody> (readonly)

Returns List of attributes associated with the entity.

Returns:



12
13
14
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 12

def attributes
  @attributes
end

#external_ids ⇒ Hash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String}) —

    A map of external ids



14
15
16
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 14

def external_ids
  @external_ids
end

#id ⇒ String (readonly)

Returns ID of the asset.

Returns:

  • (String) —

    ID of the asset



16
17
18
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 16

def id
  @id
end

#tags ⇒ Object (readonly)

associated with the Asset.



20
21
22
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 20

def tags
  @tags
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::AssetsInputsAssetResponseResponseBody

Parameters:

  • json_object (String)

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 52

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  attributes = parsed_json["attributes"]&.map do | item |
  item = item.to_json
  Samsara::Types::GoaAttributeTinyResponseBody.from_json(json_object: item)
end
  external_ids = parsed_json["externalIds"]
  id = parsed_json["id"]
  tags = parsed_json["tags"]&.map do | item |
  item = item.to_json
  Samsara::Types::GoaTagTinyResponseResponseBody.from_json(json_object: item)
end
  new(
    attributes: attributes,
    external_ids: external_ids,
    id: id,
    tags: tags,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


85
86
87
88
89
90
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 85

def self.validate_raw(obj:)
  obj.attributes&.is_a?(Array) != false || raise("Passed value for field obj.attributes 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.tags&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


76
77
78
# File 'lib/samsara_api/types/assets_inputs_asset_response_response_body.rb', line 76

def to_json
  @_field_set&.to_json
end