Class: Samsara::Types::HosClocksForDriver

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

Overview

violations.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clocks: OMIT, current_duty_status: OMIT, current_vehicle: OMIT, driver: OMIT, violations: OMIT, additional_properties: nil) ⇒ Samsara::Types::HosClocksForDriver



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 40

def initialize(clocks: OMIT, current_duty_status: OMIT, current_vehicle: OMIT, driver: OMIT, violations: OMIT, additional_properties: nil)
  @clocks = clocks if clocks != OMIT
  @current_duty_status = current_duty_status if current_duty_status != OMIT
  @current_vehicle = current_vehicle if current_vehicle != OMIT
  @driver = driver if driver != OMIT
  @violations = violations if violations != OMIT
  @additional_properties = additional_properties
  @_field_set = { "clocks": clocks, "currentDutyStatus": current_duty_status, "currentVehicle": current_vehicle, "driver": driver, "violations": violations }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



26
27
28
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 26

def additional_properties
  @additional_properties
end

#clocks ⇒ Samsara::Types::HosClocks (readonly)



16
17
18
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 16

def clocks
  @clocks
end

#current_duty_status ⇒ Samsara::Types::CurrentDutyStatus (readonly)



18
19
20
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 18

def current_duty_status
  @current_duty_status
end

#current_vehicle ⇒ Samsara::Types::VehicleTinyResponse (readonly)



20
21
22
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 20

def current_vehicle
  @current_vehicle
end

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



22
23
24
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 22

def driver
  @driver
end

#violations ⇒ Samsara::Types::HosViolations (readonly)



24
25
26
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 24

def violations
  @violations
end

Class Method Details

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



55
56
57
58
59
60
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
92
93
94
95
96
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 55

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["clocks"].nil?
    clocks = parsed_json["clocks"].to_json
    clocks = Samsara::Types::HosClocks.from_json(json_object: clocks)
  else
    clocks = nil
  end
  unless parsed_json["currentDutyStatus"].nil?
    current_duty_status = parsed_json["currentDutyStatus"].to_json
    current_duty_status = Samsara::Types::CurrentDutyStatus.from_json(json_object: current_duty_status)
  else
    current_duty_status = nil
  end
  unless parsed_json["currentVehicle"].nil?
    current_vehicle = parsed_json["currentVehicle"].to_json
    current_vehicle = Samsara::Types::VehicleTinyResponse.from_json(json_object: current_vehicle)
  else
    current_vehicle = nil
  end
  unless parsed_json["driver"].nil?
    driver = parsed_json["driver"].to_json
    driver = Samsara::Types::DriverTinyResponse.from_json(json_object: driver)
  else
    driver = nil
  end
  unless parsed_json["violations"].nil?
    violations = parsed_json["violations"].to_json
    violations = Samsara::Types::HosViolations.from_json(json_object: violations)
  else
    violations = nil
  end
  new(
    clocks: clocks,
    current_duty_status: current_duty_status,
    current_vehicle: current_vehicle,
    driver: driver,
    violations: violations,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void



109
110
111
112
113
114
115
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 109

def self.validate_raw(obj:)
  obj.clocks.nil? || Samsara::Types::HosClocks.validate_raw(obj: obj.clocks)
  obj.current_duty_status.nil? || Samsara::Types::CurrentDutyStatus.validate_raw(obj: obj.current_duty_status)
  obj.current_vehicle.nil? || Samsara::Types::VehicleTinyResponse.validate_raw(obj: obj.current_vehicle)
  obj.driver.nil? || Samsara::Types::DriverTinyResponse.validate_raw(obj: obj.driver)
  obj.violations.nil? || Samsara::Types::HosViolations.validate_raw(obj: obj.violations)
end

Instance Method Details

#to_json ⇒ String



100
101
102
# File 'lib/samsara_api/types/hos_clocks_for_driver.rb', line 100

def to_json
  @_field_set&.to_json
end