Class: Samsara::Types::DriverRulesetObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DriverRulesetObjectResponseBody
- Defined in:
- lib/samsara_api/types/driver_ruleset_object_response_body.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#break_ ⇒ Object
readonly
Valid values: ‘Property (off-duty/sleeper)`, `Explosives/HazMat (on-duty)`.
-
#cycle ⇒ Object
readonly
1 (80 hour / 7 day)‘, `Canada North Cycle 2 (120 hour / 14 day)`.
-
#jurisdiction ⇒ Object
readonly
ISO 3166-2 postal code for the supported state or territory.
-
#restart ⇒ Object
readonly
Restart`, ‘24-hour Restart`, `36-hour Restart`, `72-hour Restart`.
-
#shift ⇒ Object
readonly
Interstate Property`, ‘US Interstate Passenger`.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::DriverRulesetObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(break_: OMIT, cycle: OMIT, jurisdiction: OMIT, restart: OMIT, shift: OMIT, additional_properties: nil) ⇒ Samsara::Types::DriverRulesetObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(break_: OMIT, cycle: OMIT, jurisdiction: OMIT, restart: OMIT, shift: OMIT, additional_properties: nil) ⇒ Samsara::Types::DriverRulesetObjectResponseBody
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#cycle ⇒ Object (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 |
#jurisdiction ⇒ Object (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 |
#restart ⇒ Object (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 |
#shift ⇒ Object (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
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
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_json ⇒ 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 |