Class: Samsara::Types::AssetResponseBody

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

Overview

Representation of a 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(created_at_time:, external_ids: OMIT, id:, license_plate: OMIT, make: OMIT, model: OMIT, name: OMIT, notes: OMIT, regulation_mode: OMIT, serial_number: OMIT, tags: OMIT, type: OMIT, updated_at_time:, vin: OMIT, year: OMIT, additional_properties: nil) ⇒ Samsara::Types::AssetResponseBody

Parameters:

  • year (Long) (defaults to: OMIT) —

    The model year of the asset. Updates to this field are restricted.

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

    Additional properties unmapped to the current class definition



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/samsara_api/types/asset_response_body.rb', line 97

def initialize(created_at_time:, external_ids: OMIT, id:, license_plate: OMIT, make: OMIT, model: OMIT, name: OMIT, notes: OMIT, regulation_mode: OMIT, serial_number: OMIT, tags: OMIT, type: OMIT, updated_at_time:, vin: OMIT, year: OMIT, additional_properties: nil)
  @created_at_time = created_at_time
  @external_ids = external_ids if external_ids != OMIT
  @id = id
  @license_plate = license_plate if license_plate != OMIT
  @make = make if make != OMIT
  @model = model if model != OMIT
  @name = name if name != OMIT
  @notes = notes if notes != OMIT
  @regulation_mode = regulation_mode if regulation_mode != OMIT
  @serial_number = serial_number if serial_number != OMIT
  @tags = tags if tags != OMIT
  @type = type if type != OMIT
  @updated_at_time = updated_at_time
  @vin = vin if vin != OMIT
  @year = year if year != OMIT
  @additional_properties = additional_properties
  @_field_set = { "createdAtTime": created_at_time, "externalIds": external_ids, "id": id, "licensePlate": license_plate, "make": make, "model": model, "name": name, "notes": notes, "regulationMode": regulation_mode, "serialNumber": serial_number, "tags": tags, "type": type, "updatedAtTime": updated_at_time, "vin": vin, "year": year }.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



58
59
60
# File 'lib/samsara_api/types/asset_response_body.rb', line 58

def additional_properties
  @additional_properties
end

#created_at_time ⇒ String (readonly)

Returns The time the asset was created in RFC 3339 format.

Returns:

  • (String) —

    The time the asset was created in RFC 3339 format.



13
14
15
# File 'lib/samsara_api/types/asset_response_body.rb', line 13

def created_at_time
  @created_at_time
end

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

Returns A map of external ids.

Returns:

  • (Hash{String => String}) —

    A map of external ids



15
16
17
# File 'lib/samsara_api/types/asset_response_body.rb', line 15

def external_ids
  @external_ids
end

#id ⇒ String (readonly)

Returns The unique ID of the asset.

Returns:

  • (String) —

    The unique ID of the asset.



17
18
19
# File 'lib/samsara_api/types/asset_response_body.rb', line 17

def id
  @id
end

#license_plate ⇒ String (readonly)

Returns The license plate of the asset.

Returns:

  • (String) —

    The license plate of the asset.



19
20
21
# File 'lib/samsara_api/types/asset_response_body.rb', line 19

def license_plate
  @license_plate
end

#make ⇒ String (readonly)

Returns The OEM/manufacturer of the asset. Updates to this field are restricted.

Returns:

  • (String) —

    The OEM/manufacturer of the asset. Updates to this field are restricted.



21
22
23
# File 'lib/samsara_api/types/asset_response_body.rb', line 21

def make
  @make
end

#model ⇒ String (readonly)

Returns The model of the asset. Updates to this field are restricted.

Returns:

  • (String) —

    The model of the asset. Updates to this field are restricted.



23
24
25
# File 'lib/samsara_api/types/asset_response_body.rb', line 23

def model
  @model
end

#name ⇒ Object (readonly)

API at any time.



29
30
31
# File 'lib/samsara_api/types/asset_response_body.rb', line 29

def name
  @name
end

#notes ⇒ Object (readonly)

Samsara Dashboard or the API at any time.



32
33
34
# File 'lib/samsara_api/types/asset_response_body.rb', line 32

def notes
  @notes
end

#regulation_mode ⇒ Object (readonly)

regulated, unregulated



36
37
38
# File 'lib/samsara_api/types/asset_response_body.rb', line 36

def regulation_mode
  @regulation_mode
end

#serial_number ⇒ Object (readonly)

hold legacy VIN/PIN numbers such as ones of shorter lengths.



39
40
41
# File 'lib/samsara_api/types/asset_response_body.rb', line 39

def serial_number
  @serial_number
end

#tags ⇒ Object (readonly)

associated with the Asset.



43
44
45
# File 'lib/samsara_api/types/asset_response_body.rb', line 43

def tags
  @tags
end

#type ⇒ Object (readonly)

trailer, equipment, unpowered, vehicle



49
50
51
# File 'lib/samsara_api/types/asset_response_body.rb', line 49

def type
  @type
end

#updated_at_time ⇒ String (readonly)

Returns The time the asset was last updated in RFC 3339 format.

Returns:

  • (String) —

    The time the asset was last updated in RFC 3339 format.



51
52
53
# File 'lib/samsara_api/types/asset_response_body.rb', line 51

def updated_at_time
  @updated_at_time
end

#vin ⇒ Object (readonly)

Identification Number) of the asset.



54
55
56
# File 'lib/samsara_api/types/asset_response_body.rb', line 54

def vin
  @vin
end

#year ⇒ Long (readonly)

Returns The model year of the asset. Updates to this field are restricted.

Returns:

  • (Long) —

    The model year of the asset. Updates to this field are restricted.



56
57
58
# File 'lib/samsara_api/types/asset_response_body.rb', line 56

def year
  @year
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/samsara_api/types/asset_response_body.rb', line 122

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  created_at_time = parsed_json["createdAtTime"]
  external_ids = parsed_json["externalIds"]
  id = parsed_json["id"]
  license_plate = parsed_json["licensePlate"]
  make = parsed_json["make"]
  model = parsed_json["model"]
  name = parsed_json["name"]
  notes = parsed_json["notes"]
  regulation_mode = parsed_json["regulationMode"]
  serial_number = parsed_json["serialNumber"]
  tags = parsed_json["tags"]&.map do | item |
  item = item.to_json
  Samsara::Types::GoaTagTinyResponseResponseBody.from_json(json_object: item)
end
  type = parsed_json["type"]
  updated_at_time = parsed_json["updatedAtTime"]
  vin = parsed_json["vin"]
  year = parsed_json["year"]
  new(
    created_at_time: created_at_time,
    external_ids: external_ids,
    id: id,
    license_plate: license_plate,
    make: make,
    model: model,
    name: name,
    notes: notes,
    regulation_mode: regulation_mode,
    serial_number: serial_number,
    tags: tags,
    type: type,
    updated_at_time: updated_at_time,
    vin: vin,
    year: year,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/samsara_api/types/asset_response_body.rb', line 174

def self.validate_raw(obj:)
  obj.created_at_time.is_a?(String) != false || raise("Passed value for field obj.created_at_time 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.make&.is_a?(String) != false || raise("Passed value for field obj.make is not the expected type, validation failed.")
  obj.model&.is_a?(String) != false || raise("Passed value for field obj.model 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.notes&.is_a?(String) != false || raise("Passed value for field obj.notes is not the expected type, validation failed.")
  obj.regulation_mode&.is_a?(Samsara::Types::AssetResponseBodyRegulationMode) != false || raise("Passed value for field obj.regulation_mode is not the expected type, validation failed.")
  obj.serial_number&.is_a?(String) != false || raise("Passed value for field obj.serial_number 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.")
  obj.type&.is_a?(Samsara::Types::AssetResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.updated_at_time.is_a?(String) != false || raise("Passed value for field obj.updated_at_time 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.")
  obj.year&.is_a?(Long) != false || raise("Passed value for field obj.year is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


165
166
167
# File 'lib/samsara_api/types/asset_response_body.rb', line 165

def to_json
  @_field_set&.to_json
end