Class: Samsara::Types::VehicleSensorConfigurationDoorResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleSensorConfigurationDoorResponseBody
- Defined in:
- lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb
Overview
A door monitor configuration on a vehicle
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#position ⇒ Object
readonly
right. - #sensor ⇒ Samsara::Types::SensorResponseBody readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::VehicleSensorConfigurationDoorResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(position:, sensor:, additional_properties: nil) ⇒ Samsara::Types::VehicleSensorConfigurationDoorResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(position:, sensor:, additional_properties: nil) ⇒ Samsara::Types::VehicleSensorConfigurationDoorResponseBody
29 30 31 32 33 34 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 29 def initialize(position:, sensor:, additional_properties: nil) @position = position @sensor = sensor @additional_properties = additional_properties @_field_set = { "position": position, "sensor": sensor } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 17 def additional_properties @additional_properties end |
#position ⇒ Object (readonly)
right
13 14 15 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 13 def position @position end |
#sensor ⇒ Samsara::Types::SensorResponseBody (readonly)
15 16 17 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 15 def sensor @sensor end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleSensorConfigurationDoorResponseBody
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) position = parsed_json["position"] unless parsed_json["sensor"].nil? sensor = parsed_json["sensor"].to_json sensor = Samsara::Types::SensorResponseBody.from_json(json_object: sensor) else sensor = nil end new( position: position, sensor: sensor, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 69 def self.validate_raw(obj:) obj.position.is_a?(Samsara::Types::VehicleSensorConfigurationDoorResponseBodyPosition) != false || raise("Passed value for field obj.position is not the expected type, validation failed.") Samsara::Types::SensorResponseBody.validate_raw(obj: obj.sensor) end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_door_response_body.rb', line 60 def to_json @_field_set&.to_json end |