Class: Samsara::Types::AssetsInputsResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::AssetsInputsResponseResponseBody
- Defined in:
- lib/samsara_api/types/assets_inputs_response_response_body.rb
Overview
Full assets inputs objects.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #asset ⇒ Samsara::Types::AssetsInputsAssetResponseResponseBody readonly
- #aux_input ⇒ Samsara::Types::AssetsInputsAuxInputResponseBody readonly
-
#happened_at_time ⇒ String
readonly
UTC timestamp in RFC 3339 format of the event.
-
#units ⇒ Object
readonly
‘millivolts`, `microamps`.
-
#value ⇒ String
readonly
Value of the data point.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::AssetsInputsResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(asset:, aux_input: OMIT, happened_at_time:, units:, value:, additional_properties: nil) ⇒ Samsara::Types::AssetsInputsResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(asset:, aux_input: OMIT, happened_at_time:, units:, value:, additional_properties: nil) ⇒ Samsara::Types::AssetsInputsResponseResponseBody
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 39 def initialize(asset:, aux_input: OMIT, happened_at_time:, units:, value:, additional_properties: nil) @asset = asset @aux_input = aux_input if aux_input != OMIT @happened_at_time = happened_at_time @units = units @value = value @additional_properties = additional_properties @_field_set = { "asset": asset, "auxInput": aux_input, "happenedAtTime": happened_at_time, "units": units, "value": value }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 24 def additional_properties @additional_properties end |
#asset ⇒ Samsara::Types::AssetsInputsAssetResponseResponseBody (readonly)
13 14 15 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 13 def asset @asset end |
#aux_input ⇒ Samsara::Types::AssetsInputsAuxInputResponseBody (readonly)
15 16 17 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 15 def aux_input @aux_input end |
#happened_at_time ⇒ String (readonly)
Returns UTC timestamp in RFC 3339 format of the event.
17 18 19 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 17 def happened_at_time @happened_at_time end |
#units ⇒ Object (readonly)
‘millivolts`, `microamps`
20 21 22 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 20 def units @units end |
#value ⇒ String (readonly)
Returns Value of the data point.
22 23 24 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 22 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AssetsInputsResponseResponseBody
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["asset"].nil? asset = parsed_json["asset"].to_json asset = Samsara::Types::AssetsInputsAssetResponseResponseBody.from_json(json_object: asset) else asset = nil end unless parsed_json["auxInput"].nil? aux_input = parsed_json["auxInput"].to_json aux_input = Samsara::Types::AssetsInputsAuxInputResponseBody.from_json(json_object: aux_input) else aux_input = nil end happened_at_time = parsed_json["happenedAtTime"] units = parsed_json["units"] value = parsed_json["value"] new( asset: asset, aux_input: aux_input, happened_at_time: happened_at_time, units: units, value: value, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
93 94 95 96 97 98 99 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 93 def self.validate_raw(obj:) Samsara::Types::AssetsInputsAssetResponseResponseBody.validate_raw(obj: obj.asset) obj.aux_input.nil? || Samsara::Types::AssetsInputsAuxInputResponseBody.validate_raw(obj: obj.aux_input) obj.happened_at_time.is_a?(String) != false || raise("Passed value for field obj.happened_at_time is not the expected type, validation failed.") obj.units.is_a?(Samsara::Types::AssetsInputsResponseResponseBodyUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.") obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
84 85 86 |
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 84 def to_json @_field_set&.to_json end |