Class: Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody
- Defined in:
- lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb
Overview
A camera device 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
The ID of the camera device associated with the alert.
-
#name ⇒ String
readonly
The name of the camera device.
-
#sites ⇒ Array<Samsara::Types::AlertObjectSitesResponseBody>
readonly
The list of sites associated with the camera device.
-
#tags ⇒ Object
readonly
associated with the camera device.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id:, name: OMIT, sites: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, name: OMIT, sites: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 37 def initialize(id:, name: OMIT, sites: OMIT, tags: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @sites = sites if sites != OMIT = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "sites": sites, "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.
22 23 24 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 22 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns The ID of the camera device associated with the alert.
12 13 14 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 12 def id @id end |
#name ⇒ String (readonly)
Returns The name of the camera device.
14 15 16 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 14 def name @name end |
#sites ⇒ Array<Samsara::Types::AlertObjectSitesResponseBody> (readonly)
Returns The list of sites associated with the camera device.
16 17 18 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 16 def sites @sites end |
#tags ⇒ Object (readonly)
associated with the camera device.
20 21 22 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 20 def end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertObjectWorkforceCameraDeviceResponseBody
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 52 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"] sites = parsed_json["sites"]&.map do | item | item = item.to_json Samsara::Types::AlertObjectSitesResponseBody.from_json(json_object: item) 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, sites: sites, tags: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
86 87 88 89 90 91 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 86 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.sites&.is_a?(Array) != false || raise("Passed value for field obj.sites is not the expected type, validation failed.") 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
77 78 79 |
# File 'lib/samsara_api/types/alert_object_workforce_camera_device_response_body.rb', line 77 def to_json @_field_set&.to_json end |