Class: Samsara::Types::CameraDetailsResponseResponseBody

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

Overview

Camera-specific health metadata details.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway_last_connected_time: OMIT, last_fifty_hours_uptime_percentage: OMIT, vehicle_gateway_serial: OMIT, additional_properties: nil) ⇒ Samsara::Types::CameraDetailsResponseResponseBody

Parameters:

  • vehicle_gateway_serial (String) (defaults to: OMIT)

    The serial number of the vehicle gateway that the camera is connected to.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



33
34
35
36
37
38
39
40
41
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 33

def initialize(gateway_last_connected_time: OMIT, last_fifty_hours_uptime_percentage: OMIT, vehicle_gateway_serial: OMIT, additional_properties: nil)
  @gateway_last_connected_time = gateway_last_connected_time if gateway_last_connected_time != OMIT
  @last_fifty_hours_uptime_percentage = last_fifty_hours_uptime_percentage if last_fifty_hours_uptime_percentage != OMIT
  @vehicle_gateway_serial = vehicle_gateway_serial if vehicle_gateway_serial != OMIT
  @additional_properties = additional_properties
  @_field_set = { "gatewayLastConnectedTime": gateway_last_connected_time, "lastFiftyHoursUptimePercentage": last_fifty_hours_uptime_percentage, "vehicleGatewaySerial": vehicle_gateway_serial }.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



19
20
21
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 19

def additional_properties
  @additional_properties
end

#gateway_last_connected_timeObject (readonly)

format.



12
13
14
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 12

def gateway_last_connected_time
  @gateway_last_connected_time
end

#last_fifty_hours_uptime_percentageObject (readonly)

on an active trip over the past 50 hours, in percentage points.



15
16
17
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 15

def last_fifty_hours_uptime_percentage
  @last_fifty_hours_uptime_percentage
end

#vehicle_gateway_serialString (readonly)

Returns The serial number of the vehicle gateway that the camera is connected to.

Returns:

  • (String)

    The serial number of the vehicle gateway that the camera is connected to.



17
18
19
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 17

def vehicle_gateway_serial
  @vehicle_gateway_serial
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  gateway_last_connected_time = unless parsed_json["gatewayLastConnectedTime"].nil?
  DateTime.parse(parsed_json["gatewayLastConnectedTime"])
else
  nil
end
  last_fifty_hours_uptime_percentage = parsed_json["lastFiftyHoursUptimePercentage"]
  vehicle_gateway_serial = parsed_json["vehicleGatewaySerial"]
  new(
    gateway_last_connected_time: gateway_last_connected_time,
    last_fifty_hours_uptime_percentage: last_fifty_hours_uptime_percentage,
    vehicle_gateway_serial: vehicle_gateway_serial,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


75
76
77
78
79
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 75

def self.validate_raw(obj:)
  obj.gateway_last_connected_time&.is_a?(DateTime) != false || raise("Passed value for field obj.gateway_last_connected_time is not the expected type, validation failed.")
  obj.last_fifty_hours_uptime_percentage&.is_a?(Float) != false || raise("Passed value for field obj.last_fifty_hours_uptime_percentage is not the expected type, validation failed.")
  obj.vehicle_gateway_serial&.is_a?(String) != false || raise("Passed value for field obj.vehicle_gateway_serial is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


66
67
68
# File 'lib/samsara_api/types/camera_details_response_response_body.rb', line 66

def to_json
  @_field_set&.to_json
end