Class: Samsara::Types::AssetsInputsResponseResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset:, aux_input: OMIT, happened_at_time:, units:, value:, additional_properties: nil) ⇒ Samsara::Types::AssetsInputsResponseResponseBody

Parameters:

  • value (String)

    Value of the data point.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#assetSamsara::Types::AssetsInputsAssetResponseResponseBody (readonly)



13
14
15
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 13

def asset
  @asset
end

#aux_inputSamsara::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_timeString (readonly)

Returns UTC timestamp in RFC 3339 format of the event.

Returns:

  • (String)

    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

#unitsObject (readonly)

‘millivolts`, `microamps`



20
21
22
# File 'lib/samsara_api/types/assets_inputs_response_response_body.rb', line 20

def units
  @units
end

#valueString (readonly)

Returns Value of the data point.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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