Class: Samsara::Types::UnitResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::UnitResponseBody
- Defined in:
- lib/samsara_api/types/unit_response_body.rb
Overview
Unit information
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#base_unit ⇒ Object
readonly
‘second`, `usd`, `usgallongaseousfuel`, `volt`, `watthour`.
-
#measurement_type ⇒ Object
readonly
‘temperature`, `time`, `voltage`, `volume`, `weight`, `wetSpreadRate`.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(base_unit: OMIT, measurement_type: OMIT, additional_properties: nil) ⇒ Samsara::Types::UnitResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(base_unit: OMIT, measurement_type: OMIT, additional_properties: nil) ⇒ Samsara::Types::UnitResponseBody
51 52 53 54 55 56 57 58 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 51 def initialize(base_unit: OMIT, measurement_type: OMIT, additional_properties: nil) @base_unit = base_unit if base_unit != OMIT @measurement_type = measurement_type if measurement_type != OMIT @additional_properties = additional_properties @_field_set = { "baseUnit": base_unit, "measurementType": measurement_type }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 28 def additional_properties @additional_properties end |
#base_unit ⇒ Object (readonly)
‘second`, `usd`, `usgallongaseousfuel`, `volt`, `watthour`
21 22 23 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 21 def base_unit @base_unit end |
#measurement_type ⇒ Object (readonly)
‘temperature`, `time`, `voltage`, `volume`, `weight`, `wetSpreadRate`
26 27 28 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 26 def measurement_type @measurement_type end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::UnitResponseBody
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 63 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) base_unit = parsed_json["baseUnit"] measurement_type = parsed_json["measurementType"] new( base_unit: base_unit, measurement_type: measurement_type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
86 87 88 89 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 86 def self.validate_raw(obj:) obj.base_unit&.is_a?(Samsara::Types::UnitResponseBodyBaseUnit) != false || raise("Passed value for field obj.base_unit is not the expected type, validation failed.") obj.measurement_type&.is_a?(Samsara::Types::UnitResponseBodyMeasurementType) != false || raise("Passed value for field obj.measurement_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
77 78 79 |
# File 'lib/samsara_api/types/unit_response_body.rb', line 77 def to_json @_field_set&.to_json end |