Class: Samsara::Types::GetVehiclesDriverAssignmentsResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::GetVehiclesDriverAssignmentsResponseBody
- Defined in:
- lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#data ⇒ Array<Samsara::Types::VehiclesDriverAssignmentsObjectResponseBody>
readonly
List of vehicles and their driver assignments.
- #pagination ⇒ Samsara::Types::GoaPaginationResponseResponseBody readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::GetVehiclesDriverAssignmentsResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(data:, pagination:, additional_properties: nil) ⇒ Samsara::Types::GetVehiclesDriverAssignmentsResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(data:, pagination:, additional_properties: nil) ⇒ Samsara::Types::GetVehiclesDriverAssignmentsResponseBody
26 27 28 29 30 31 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 26 def initialize(data:, pagination:, additional_properties: nil) @data = data @pagination = pagination @additional_properties = additional_properties @_field_set = { "data": data, "pagination": pagination } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 15 def additional_properties @additional_properties end |
#data ⇒ Array<Samsara::Types::VehiclesDriverAssignmentsObjectResponseBody> (readonly)
Returns List of vehicles and their driver assignments.
11 12 13 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 11 def data @data end |
#pagination ⇒ Samsara::Types::GoaPaginationResponseResponseBody (readonly)
13 14 15 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 13 def pagination @pagination end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::GetVehiclesDriverAssignmentsResponseBody
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) data = parsed_json["data"]&.map do | item | item = item.to_json Samsara::Types::VehiclesDriverAssignmentsObjectResponseBody.from_json(json_object: item) end unless parsed_json["pagination"].nil? pagination = parsed_json["pagination"].to_json pagination = Samsara::Types::GoaPaginationResponseResponseBody.from_json(json_object: pagination) else pagination = nil end new( data: data, pagination: pagination, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 69 def self.validate_raw(obj:) obj.data.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") Samsara::Types::GoaPaginationResponseResponseBody.validate_raw(obj: obj.pagination) end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/samsara_api/types/get_vehicles_driver_assignments_response_body.rb', line 60 def to_json @_field_set&.to_json end |