Class: Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coach_id:, created_at_time:, driver:, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::CoachAssignmentWithDriverExternalIdsResponseResponseBody

Parameters:

  • coach_id (String) —

    Coach ID associated with coach assignment. Always returned.

  • created_at_time (DateTime) —

    Time coach assignment was created in UTC. Always returned.

  • driver (Samsara::Types::DriverWithExternalIdObjectResponseBody)
  • updated_at_time (DateTime) —

    Time coaching assignment was updated in UTC. Always returned.

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

    Additional properties unmapped to the current class definition



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.

Returns:

  • (OpenStruct) —

    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.

Returns:

  • (String) —

    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.

Returns:

  • (DateTime) —

    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.

Returns:

  • (DateTime) —

    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

Parameters:

  • obj (Object)

Returns:

  • (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

Returns:

  • (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