Class: Samsara::Types::CoachAssignmentWithoutDriverExternalIdsResponseResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/coach_assignment_without_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: OMIT, created_at_time:, driver_id:, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::CoachAssignmentWithoutDriverExternalIdsResponseResponseBody

Parameters:

  • created_at_time (DateTime) —

    Time coach assignment was created in UTC. Always returned.

  • driver_id (String) —

    Unique user ID for the driver of the driver coach assignment

  • 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



35
36
37
38
39
40
41
42
43
44
# File 'lib/samsara_api/types/coach_assignment_without_driver_external_ids_response_response_body.rb', line 35

def initialize(coach_id: OMIT, created_at_time:, driver_id:, updated_at_time:, additional_properties: nil)
  @coach_id = coach_id if coach_id != OMIT
  @created_at_time = created_at_time
  @driver_id = driver_id
  @updated_at_time = updated_at_time
  @additional_properties = additional_properties
  @_field_set = { "coachId": coach_id, "createdAtTime": created_at_time, "driverId": driver_id, "updatedAtTime": updated_at_time }.reject do | _k, v |
  v == OMIT
end
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_without_driver_external_ids_response_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#coach_id ⇒ Object (readonly)

coach is assigned



13
14
15
# File 'lib/samsara_api/types/coach_assignment_without_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_without_driver_external_ids_response_response_body.rb', line 15

def created_at_time
  @created_at_time
end

#driver_id ⇒ String (readonly)

Returns Unique user ID for the driver of the driver coach assignment.

Returns:

  • (String) —

    Unique user ID for the driver of the driver coach assignment



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

def driver_id
  @driver_id
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_without_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::CoachAssignmentWithoutDriverExternalIdsResponseResponseBody



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/samsara_api/types/coach_assignment_without_driver_external_ids_response_response_body.rb', line 50

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
  driver_id = parsed_json["driverId"]
  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_id: driver_id,
    updated_at_time: updated_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


86
87
88
89
90
91
# File 'lib/samsara_api/types/coach_assignment_without_driver_external_ids_response_response_body.rb', line 86

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.")
  obj.driver_id.is_a?(String) != false || raise("Passed value for field obj.driver_id is not the expected type, validation failed.")
  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)


77
78
79
# File 'lib/samsara_api/types/coach_assignment_without_driver_external_ids_response_response_body.rb', line 77

def to_json
  @_field_set&.to_json
end