Class: Samsara::Types::HealthReasonResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::HealthReasonResponseResponseBody
- Defined in:
- lib/samsara_api/types/health_reason_response_response_body.rb
Overview
Information about an active health reason affecting the device.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#health_reason_code ⇒ Object
readonly
‘outwardCameraObstruction`, `recordingTimeRequired`, `unknown`, `vgUnplugged`.
-
#start_time ⇒ DateTime
readonly
The timestamp when this health reason began, in RFC3339 format.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::HealthReasonResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(health_reason_code: OMIT, start_time: OMIT, additional_properties: nil) ⇒ Samsara::Types::HealthReasonResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(health_reason_code: OMIT, start_time: OMIT, additional_properties: nil) ⇒ Samsara::Types::HealthReasonResponseResponseBody
35 36 37 38 39 40 41 42 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 35 def initialize(health_reason_code: OMIT, start_time: OMIT, additional_properties: nil) @health_reason_code = health_reason_code if health_reason_code != OMIT @start_time = start_time if start_time != OMIT @additional_properties = additional_properties @_field_set = { "healthReasonCode": health_reason_code, "startTime": start_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.
20 21 22 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 20 def additional_properties @additional_properties end |
#health_reason_code ⇒ Object (readonly)
‘outwardCameraObstruction`, `recordingTimeRequired`, `unknown`, `vgUnplugged`
16 17 18 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 16 def health_reason_code @health_reason_code end |
#start_time ⇒ DateTime (readonly)
Returns The timestamp when this health reason began, in RFC3339 format.
18 19 20 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 18 def start_time @start_time end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::HealthReasonResponseResponseBody
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) health_reason_code = parsed_json["healthReasonCode"] start_time = unless parsed_json["startTime"].nil? DateTime.parse(parsed_json["startTime"]) else nil end new( health_reason_code: health_reason_code, start_time: start_time, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 74 def self.validate_raw(obj:) obj.health_reason_code&.is_a?(Samsara::Types::HealthReasonResponseResponseBodyHealthReasonCode) != false || raise("Passed value for field obj.health_reason_code is not the expected type, validation failed.") obj.start_time&.is_a?(DateTime) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/samsara_api/types/health_reason_response_response_body.rb', line 65 def to_json @_field_set&.to_json end |