Class: Samsara::Types::VehicleSensorConfigurationArea
- Inherits:
-
Object
- Object
- Samsara::Types::VehicleSensorConfigurationArea
- Defined in:
- lib/samsara_api/types/vehicle_sensor_configuration_area.rb
Overview
The sensor configuration for an area of the vehicle
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#cargo_sensors ⇒ Array<Samsara::Types::Sensor>
readonly
Cargo sensors configured in this position of the vehicle.
-
#humidity_sensors ⇒ Array<Samsara::Types::Sensor>
readonly
Humidity sensors configured in this position of the vehicle.
-
#position ⇒ Samsara::Types::VehicleSensorConfigurationAreaPosition
readonly
Position of the area on vehicle.
-
#temperature_sensors ⇒ Array<Samsara::Types::Sensor>
readonly
Temperature sensors configured in this position of the vehicle.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::VehicleSensorConfigurationArea
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(cargo_sensors: OMIT, humidity_sensors: OMIT, position: OMIT, temperature_sensors: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleSensorConfigurationArea constructor
- #to_json ⇒ String
Constructor Details
#initialize(cargo_sensors: OMIT, humidity_sensors: OMIT, position: OMIT, temperature_sensors: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleSensorConfigurationArea
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 33 def initialize(cargo_sensors: OMIT, humidity_sensors: OMIT, position: OMIT, temperature_sensors: OMIT, additional_properties: nil) @cargo_sensors = cargo_sensors if cargo_sensors != OMIT @humidity_sensors = humidity_sensors if humidity_sensors != OMIT @position = position if position != OMIT @temperature_sensors = temperature_sensors if temperature_sensors != OMIT @additional_properties = additional_properties @_field_set = { "cargoSensors": cargo_sensors, "humiditySensors": humidity_sensors, "position": position, "temperatureSensors": temperature_sensors }.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/vehicle_sensor_configuration_area.rb', line 20 def additional_properties @additional_properties end |
#cargo_sensors ⇒ Array<Samsara::Types::Sensor> (readonly)
Returns Cargo sensors configured in this position of the vehicle.
12 13 14 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 12 def cargo_sensors @cargo_sensors end |
#humidity_sensors ⇒ Array<Samsara::Types::Sensor> (readonly)
Returns Humidity sensors configured in this position of the vehicle.
14 15 16 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 14 def humidity_sensors @humidity_sensors end |
#position ⇒ Samsara::Types::VehicleSensorConfigurationAreaPosition (readonly)
Returns Position of the area on vehicle.
16 17 18 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 16 def position @position end |
#temperature_sensors ⇒ Array<Samsara::Types::Sensor> (readonly)
Returns Temperature sensors configured in this position of the vehicle.
18 19 20 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 18 def temperature_sensors @temperature_sensors end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::VehicleSensorConfigurationArea
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) cargo_sensors = parsed_json["cargoSensors"]&.map do | item | item = item.to_json Samsara::Types::Sensor.from_json(json_object: item) end humidity_sensors = parsed_json["humiditySensors"]&.map do | item | item = item.to_json Samsara::Types::Sensor.from_json(json_object: item) end position = parsed_json["position"] temperature_sensors = parsed_json["temperatureSensors"]&.map do | item | item = item.to_json Samsara::Types::Sensor.from_json(json_object: item) end new( cargo_sensors: cargo_sensors, humidity_sensors: humidity_sensors, position: position, temperature_sensors: temperature_sensors, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
83 84 85 86 87 88 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 83 def self.validate_raw(obj:) obj.cargo_sensors&.is_a?(Array) != false || raise("Passed value for field obj.cargo_sensors is not the expected type, validation failed.") obj.humidity_sensors&.is_a?(Array) != false || raise("Passed value for field obj.humidity_sensors is not the expected type, validation failed.") obj.position&.is_a?(Samsara::Types::VehicleSensorConfigurationAreaPosition) != false || raise("Passed value for field obj.position is not the expected type, validation failed.") obj.temperature_sensors&.is_a?(Array) != false || raise("Passed value for field obj.temperature_sensors is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
74 75 76 |
# File 'lib/samsara_api/types/vehicle_sensor_configuration_area.rb', line 74 def to_json @_field_set&.to_json end |