Class: Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody
- Defined in:
- lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb
Overview
Driver coach assignment object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#coach_id ⇒ String
readonly
Coach ID associated with coach assignment.
-
#created_at_time ⇒ DateTime
readonly
Time coach assignment was created in UTC.
- #driver ⇒ Samsara::Types::DriverWithExternalIdObjectResponseBody readonly
-
#updated_at_time ⇒ DateTime
readonly
Time coaching assignment was updated in UTC.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(coach_id:, created_at_time:, driver:, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(coach_id:, created_at_time:, driver:, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody
34 35 36 37 38 39 40 41 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 34 def initialize(coach_id:, created_at_time:, driver:, updated_at_time:, additional_properties: nil) @coach_id = coach_id @created_at_time = created_at_time @driver = driver @updated_at_time = updated_at_time @additional_properties = additional_properties @_field_set = { "coachId": coach_id, "createdAtTime": created_at_time, "driver": driver, "updatedAtTime": updated_at_time } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 21 def additional_properties @additional_properties end |
#coach_id ⇒ String (readonly)
Returns Coach ID associated with coach assignment. Always returned.
13 14 15 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 13 def coach_id @coach_id end |
#created_at_time ⇒ DateTime (readonly)
Returns Time coach assignment was created in UTC. Always returned.
15 16 17 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 15 def created_at_time @created_at_time end |
#driver ⇒ Samsara::Types::DriverWithExternalIdObjectResponseBody (readonly)
17 18 19 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 17 def driver @driver end |
#updated_at_time ⇒ DateTime (readonly)
Returns Time coaching assignment was updated in UTC. Always returned.
19 20 21 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 19 def updated_at_time @updated_at_time end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) coach_id = parsed_json["coachId"] created_at_time = unless parsed_json["createdAtTime"].nil? DateTime.parse(parsed_json["createdAtTime"]) else nil end unless parsed_json["driver"].nil? driver = parsed_json["driver"].to_json driver = Samsara::Types::DriverWithExternalIdObjectResponseBody.from_json(json_object: driver) else driver = nil end updated_at_time = unless parsed_json["updatedAtTime"].nil? DateTime.parse(parsed_json["updatedAtTime"]) else nil end new( coach_id: coach_id, created_at_time: created_at_time, driver: driver, updated_at_time: updated_at_time, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
88 89 90 91 92 93 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 88 def self.validate_raw(obj:) obj.coach_id.is_a?(String) != false || raise("Passed value for field obj.coach_id is not the expected type, validation failed.") obj.created_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.") Samsara::Types::DriverWithExternalIdObjectResponseBody.validate_raw(obj: obj.driver) obj.updated_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
79 80 81 |
# File 'lib/samsara_api/types/coach_assignment_with_driver_external_ids_response_response_body.rb', line 79 def to_json @_field_set&.to_json end |