Class: Samsara::Types::VehicleLocationsListResponseData
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleLocationsListResponseData
- Defined in:
- lib/samsara_api/types/vehicle_locations_list_response_data.rb
Overview
A vehicle and its list of location events.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #id ⇒ String readonly
-
#locations ⇒ Array<Samsara::Types::VehicleLocation>
readonly
A list of location events for the given vehicle.
- #name ⇒ String readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::VehicleLocationsListResponseData
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id:, locations:, name:, additional_properties: nil) ⇒ Samsara::Types::VehicleLocationsListResponseData constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, locations:, name:, additional_properties: nil) ⇒ Samsara::Types::VehicleLocationsListResponseData
29 30 31 32 33 34 35 |
# File 'lib/samsara_api/types/vehicle_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.
17 18 19 |
# File 'lib/samsara_api/types/vehicle_locations_list_response_data.rb', line 17 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
11 12 13 |
# File 'lib/samsara_api/types/vehicle_locations_list_response_data.rb', line 11 def id @id end |
#locations ⇒ Array<Samsara::Types::VehicleLocation> (readonly)
Returns A list of location events for the given vehicle.
13 14 15 |
# File 'lib/samsara_api/types/vehicle_locations_list_response_data.rb', line 13 def locations @locations end |
#name ⇒ String (readonly)
15 16 17 |
# File 'lib/samsara_api/types/vehicle_locations_list_response_data.rb', line 15 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleLocationsListResponseData
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/samsara_api/types/vehicle_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::VehicleLocation.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
68 69 70 71 72 |
# File 'lib/samsara_api/types/vehicle_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
59 60 61 |
# File 'lib/samsara_api/types/vehicle_locations_list_response_data.rb', line 59 def to_json @_field_set&.to_json end |