Class: Samsara::Types::HosViolationObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::HosViolationObjectResponseBody
- Defined in:
- lib/samsara_api/types/hos_violation_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.
- #day ⇒ Samsara::Types::HosViolationDayObjectResponseBody readonly
-
#description ⇒ Object
readonly
unsubmittedLogs: "Missing Driver Certification".
- #driver ⇒ Samsara::Types::GoaDriverTinyResponseResponseBody readonly
-
#duration_ms ⇒ Object
readonly
unsubmittedLogs). -
#type ⇒ Object
readonly
shiftOnDutyHours,unsubmittedLogs. -
#violation_start_time ⇒ String
readonly
The start time of the violation in RFC 3339 format.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::HosViolationObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(day:, description:, driver:, duration_ms:, type:, violation_start_time:, additional_properties: nil) ⇒ Samsara::Types::HosViolationObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(day:, description:, driver:, duration_ms:, type:, violation_start_time:, additional_properties: nil) ⇒ Samsara::Types::HosViolationObjectResponseBody
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 87 def initialize(day:, description:, driver:, duration_ms:, type:, violation_start_time:, additional_properties: nil) @day = day @description = description @driver = driver @duration_ms = duration_ms @type = type @violation_start_time = violation_start_time @additional_properties = additional_properties @_field_set = { "day": day, "description": description, "driver": driver, "durationMs": duration_ms, "type": type, "violationStartTime": violation_start_time } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
48 49 50 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 48 def additional_properties @additional_properties end |
#day ⇒ Samsara::Types::HosViolationDayObjectResponseBody (readonly)
12 13 14 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 12 def day @day end |
#description ⇒ Object (readonly)
unsubmittedLogs: "Missing Driver Certification"
27 28 29 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 27 def description @description end |
#driver ⇒ Samsara::Types::GoaDriverTinyResponseResponseBody (readonly)
29 30 31 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 29 def driver @driver end |
#duration_ms ⇒ Object (readonly)
unsubmittedLogs).
35 36 37 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 35 def duration_ms @duration_ms end |
#type ⇒ Object (readonly)
shiftOnDutyHours, unsubmittedLogs
44 45 46 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 44 def type @type end |
#violation_start_time ⇒ String (readonly)
Returns The start time of the violation in RFC 3339 format.
46 47 48 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 46 def violation_start_time @violation_start_time end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::HosViolationObjectResponseBody
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 101 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["day"].nil? day = parsed_json["day"].to_json day = Samsara::Types::HosViolationDayObjectResponseBody.from_json(json_object: day) else day = nil end description = parsed_json["description"] unless parsed_json["driver"].nil? driver = parsed_json["driver"].to_json driver = Samsara::Types::GoaDriverTinyResponseResponseBody.from_json(json_object: driver) else driver = nil end duration_ms = parsed_json["durationMs"] type = parsed_json["type"] violation_start_time = parsed_json["violationStartTime"] new( day: day, description: description, driver: driver, duration_ms: duration_ms, type: type, violation_start_time: violation_start_time, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
142 143 144 145 146 147 148 149 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 142 def self.validate_raw(obj:) Samsara::Types::HosViolationDayObjectResponseBody.validate_raw(obj: obj.day) obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") Samsara::Types::GoaDriverTinyResponseResponseBody.validate_raw(obj: obj.driver) obj.duration_ms.is_a?(Long) != false || raise("Passed value for field obj.duration_ms is not the expected type, validation failed.") obj.type.is_a?(Samsara::Types::HosViolationObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.violation_start_time.is_a?(String) != false || raise("Passed value for field obj.violation_start_time is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
133 134 135 |
# File 'lib/samsara_api/types/hos_violation_object_response_body.rb', line 133 def to_json @_field_set&.to_json end |