Class: Samsara::Types::EquipmentLocationsListResponseData

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

Overview

A unit of equipment and its time-series of location events.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, locations:, name:, additional_properties: nil) ⇒ Samsara::Types::EquipmentLocationsListResponseData

Parameters:

  • id (String)
  • locations (Array<Samsara::Types::EquipmentLocation>) —

    A time-series of location events for the given unit of equipment.

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

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
# File 'lib/samsara_api/types/equipment_locations_list_response_data.rb', line 29

def initialize(id:, locations:, name:, additional_properties: nil)
  @id = id
  @locations = locations
  @name = name
  @additional_properties = additional_properties
  @_field_set = { "id": id, "locations": locations, "name": name }
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



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

def additional_properties
  @additional_properties
end

#id ⇒ String (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/samsara_api/types/equipment_locations_list_response_data.rb', line 11

def id
  @id
end

#locations ⇒ Array<Samsara::Types::EquipmentLocation> (readonly)

Returns A time-series of location events for the given unit of equipment.

Returns:



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

def locations
  @locations
end

#name ⇒ String (readonly)

Returns:

  • (String)


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

def name
  @name
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/samsara_api/types/equipment_locations_list_response_data.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  locations = parsed_json["locations"]&.map do | item |
  item = item.to_json
  Samsara::Types::EquipmentLocation.from_json(json_object: item)
end
  name = parsed_json["name"]
  new(
    id: id,
    locations: locations,
    name: name,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
72
# File 'lib/samsara_api/types/equipment_locations_list_response_data.rb', line 68

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.locations.is_a?(Array) != false || raise("Passed value for field obj.locations 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.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


59
60
61
# File 'lib/samsara_api/types/equipment_locations_list_response_data.rb', line 59

def to_json
  @_field_set&.to_json
end