Class: Samsara::Types::HealthReasonResponseResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(health_reason_code: OMIT, start_time: OMIT, additional_properties: nil) ⇒ Samsara::Types::HealthReasonResponseResponseBody

Parameters:

  • start_time (DateTime) (defaults to: OMIT)

    The timestamp when this health reason began, in RFC3339 format.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_codeObject (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_timeDateTime (readonly)

Returns The timestamp when this health reason began, in RFC3339 format.

Returns:

  • (DateTime)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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