Class: Samsara::Types::GetDriverTrailerAssignmentsResponseBodyResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb

Overview

information.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at_time: OMIT, driver:, end_time: OMIT, id:, start_time:, trailer:, updated_at_time: OMIT, additional_properties: nil) ⇒ Samsara::Types::GetDriverTrailerAssignmentsResponseBodyResponseBody

Parameters:

  • created_at_time (String) (defaults to: OMIT) —

    Time when the driver trailer assignment was created, in RFC 3339 format.

  • driver (Samsara::Types::DriverWithExternalIdObjectResponseBody)
  • end_time (String) (defaults to: OMIT) —

    Time when the driver trailer assignment will end, in RFC 3339 format.

  • id (String) —

    Samsara ID of the driver trailer assignment.

  • start_time (String) —

    Time when the driver trailer assignment starts, in RFC 3339 format.

  • trailer (Samsara::Types::TrailerObjectResponseBody)
  • updated_at_time (String) (defaults to: OMIT) —

    Time when the driver trailer assignment was last updated, in RFC 3339 format.

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

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 43

def initialize(created_at_time: OMIT, driver:, end_time: OMIT, id:, start_time:, trailer:, updated_at_time: OMIT, additional_properties: nil)
  @created_at_time = created_at_time if created_at_time != OMIT
  @driver = driver
  @end_time = end_time if end_time != OMIT
  @id = id
  @start_time = start_time
  @trailer = trailer
  @updated_at_time = updated_at_time if updated_at_time != OMIT
  @additional_properties = additional_properties
  @_field_set = { "createdAtTime": created_at_time, "driver": driver, "endTime": end_time, "id": id, "startTime": start_time, "trailer": trailer, "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



27
28
29
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 27

def additional_properties
  @additional_properties
end

#created_at_time ⇒ String (readonly)

Returns Time when the driver trailer assignment was created, in RFC 3339 format.

Returns:

  • (String) —

    Time when the driver trailer assignment was created, in RFC 3339 format.



13
14
15
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 13

def created_at_time
  @created_at_time
end

#driver ⇒ Samsara::Types::DriverWithExternalIdObjectResponseBody (readonly)



15
16
17
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 15

def driver
  @driver
end

#end_time ⇒ String (readonly)

Returns Time when the driver trailer assignment will end, in RFC 3339 format.

Returns:

  • (String) —

    Time when the driver trailer assignment will end, in RFC 3339 format.



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

def end_time
  @end_time
end

#id ⇒ String (readonly)

Returns Samsara ID of the driver trailer assignment.

Returns:

  • (String) —

    Samsara ID of the driver trailer assignment.



19
20
21
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 19

def id
  @id
end

#start_time ⇒ String (readonly)

Returns Time when the driver trailer assignment starts, in RFC 3339 format.

Returns:

  • (String) —

    Time when the driver trailer assignment starts, in RFC 3339 format.



21
22
23
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 21

def start_time
  @start_time
end

#trailer ⇒ Samsara::Types::TrailerObjectResponseBody (readonly)



23
24
25
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 23

def trailer
  @trailer
end

#updated_at_time ⇒ String (readonly)

Returns Time when the driver trailer assignment was last updated, in RFC 3339 format.

Returns:

  • (String) —

    Time when the driver trailer assignment was last updated, in RFC 3339 format.



25
26
27
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 25

def updated_at_time
  @updated_at_time
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::GetDriverTrailerAssignmentsResponseBodyResponseBody

Parameters:

  • json_object (String)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  created_at_time = parsed_json["createdAtTime"]
  unless parsed_json["driver"].nil?
    driver = parsed_json["driver"].to_json
    driver = Samsara::Types::DriverWithExternalIdObjectResponseBody.from_json(json_object: driver)
  else
    driver = nil
  end
  end_time = parsed_json["endTime"]
  id = parsed_json["id"]
  start_time = parsed_json["startTime"]
  unless parsed_json["trailer"].nil?
    trailer = parsed_json["trailer"].to_json
    trailer = Samsara::Types::TrailerObjectResponseBody.from_json(json_object: trailer)
  else
    trailer = nil
  end
  updated_at_time = parsed_json["updatedAtTime"]
  new(
    created_at_time: created_at_time,
    driver: driver,
    end_time: end_time,
    id: id,
    start_time: start_time,
    trailer: trailer,
    updated_at_time: updated_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


105
106
107
108
109
110
111
112
113
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 105

def self.validate_raw(obj:)
  obj.created_at_time&.is_a?(String) != 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.end_time&.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.start_time.is_a?(String) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.")
  Samsara::Types::TrailerObjectResponseBody.validate_raw(obj: obj.trailer)
  obj.updated_at_time&.is_a?(String) != 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)


96
97
98
# File 'lib/samsara_api/types/get_driver_trailer_assignments_response_body_response_body.rb', line 96

def to_json
  @_field_set&.to_json
end