Class: Samsara::Types::DriverRulesetObjectResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(break_: OMIT, cycle: OMIT, jurisdiction: OMIT, restart: OMIT, shift: OMIT, additional_properties: nil) ⇒ Samsara::Types::DriverRulesetObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 63

def initialize(break_: OMIT, cycle: OMIT, jurisdiction: OMIT, restart: OMIT, shift: OMIT, additional_properties: nil)
  @break_ = break_ if break_ != OMIT
  @cycle = cycle if cycle != OMIT
  @jurisdiction = jurisdiction if jurisdiction != OMIT
  @restart = restart if restart != OMIT
  @shift = shift if shift != OMIT
  @additional_properties = additional_properties
  @_field_set = { "break": break_, "cycle": cycle, "jurisdiction": jurisdiction, "restart": restart, "shift": shift }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



36
37
38
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 36

def additional_properties
  @additional_properties
end

#break_Object (readonly)

Valid values: ‘Property (off-duty/sleeper)`, `Explosives/HazMat (on-duty)`



14
15
16
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 14

def break_
  @break_
end

#cycleObject (readonly)

1 (80 hour / 7 day)‘, `Canada North Cycle 2 (120 hour / 14 day)`



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

def cycle
  @cycle
end

#jurisdictionObject (readonly)

ISO 3166-2 postal code for the supported state or territory.



28
29
30
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 28

def jurisdiction
  @jurisdiction
end

#restartObject (readonly)

Restart`, ‘24-hour Restart`, `36-hour Restart`, `72-hour Restart`



31
32
33
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 31

def restart
  @restart
end

#shiftObject (readonly)

Interstate Property`, ‘US Interstate Passenger`



34
35
36
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 34

def shift
  @shift
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 78

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  break_ = parsed_json["break"]
  cycle = parsed_json["cycle"]
  jurisdiction = parsed_json["jurisdiction"]
  restart = parsed_json["restart"]
  shift = parsed_json["shift"]
  new(
    break_: break_,
    cycle: cycle,
    jurisdiction: jurisdiction,
    restart: restart,
    shift: shift,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

def self.validate_raw(obj:)
  obj.break_&.is_a?(Samsara::Types::DriverRulesetObjectResponseBodyBreak) != false || raise("Passed value for field obj.break_ is not the expected type, validation failed.")
  obj.cycle&.is_a?(Samsara::Types::DriverRulesetObjectResponseBodyCycle) != false || raise("Passed value for field obj.cycle is not the expected type, validation failed.")
  obj.jurisdiction&.is_a?(String) != false || raise("Passed value for field obj.jurisdiction is not the expected type, validation failed.")
  obj.restart&.is_a?(Samsara::Types::DriverRulesetObjectResponseBodyRestart) != false || raise("Passed value for field obj.restart is not the expected type, validation failed.")
  obj.shift&.is_a?(Samsara::Types::DriverRulesetObjectResponseBodyShift) != false || raise("Passed value for field obj.shift is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


98
99
100
# File 'lib/samsara_api/types/driver_ruleset_object_response_body.rb', line 98

def to_json
  @_field_set&.to_json
end