Class: Samsara::Types::AlertObjectSensorResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::AlertObjectSensorResponseBody
- Defined in:
- lib/samsara_api/types/alert_object_sensor_response_body.rb
Overview
A sensor associated with the alert.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
Thye ID of the sensor associated with the alert.
-
#name ⇒ String
readonly
The name of the sensor.
-
#pinned_device_id ⇒ String
readonly
The Pinned Device ID associated with the alert.
- #product ⇒ Samsara::Types::AlertObjectProductResponseBody readonly
-
#tags ⇒ Object
readonly
associated with the sensor.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, name: OMIT, pinned_device_id: OMIT, product: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectSensorResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, name: OMIT, pinned_device_id: OMIT, product: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectSensorResponseBody
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 40 def initialize(id:, name: OMIT, pinned_device_id: OMIT, product: OMIT, tags: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @pinned_device_id = pinned_device_id if pinned_device_id != OMIT @product = product if product != OMIT = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "pinnedDeviceId": pinned_device_id, "product": product, "tags": }.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/alert_object_sensor_response_body.rb', line 24 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns Thye ID of the sensor associated with the alert.
12 13 14 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 12 def id @id end |
#name ⇒ String (readonly)
Returns The name of the sensor.
14 15 16 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 14 def name @name end |
#pinned_device_id ⇒ String (readonly)
Returns The Pinned Device ID associated with the alert.
16 17 18 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 16 def pinned_device_id @pinned_device_id end |
#product ⇒ Samsara::Types::AlertObjectProductResponseBody (readonly)
18 19 20 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 18 def product @product end |
#tags ⇒ Object (readonly)
associated with the sensor.
22 23 24 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 22 def end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertObjectSensorResponseBody
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 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] pinned_device_id = parsed_json["pinnedDeviceId"] unless parsed_json["product"].nil? product = parsed_json["product"].to_json product = Samsara::Types::AlertObjectProductResponseBody.from_json(json_object: product) else product = nil end = parsed_json["tags"]&.map do | item | item = item.to_json Samsara::Types::GoaTagTinyResponseResponseBody.from_json(json_object: item) end new( id: id, name: name, pinned_device_id: pinned_device_id, product: product, tags: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
92 93 94 95 96 97 98 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 92 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.pinned_device_id&.is_a?(String) != false || raise("Passed value for field obj.pinned_device_id is not the expected type, validation failed.") obj.product.nil? || Samsara::Types::AlertObjectProductResponseBody.validate_raw(obj: obj.product) obj.&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
83 84 85 |
# File 'lib/samsara_api/types/alert_object_sensor_response_body.rb', line 83 def to_json @_field_set&.to_json end |