Class: Samsara::Types::AlertObjectSitesResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::AlertObjectSitesResponseBody
- Defined in:
- lib/samsara_api/types/alert_object_sites_response_body.rb
Overview
A site 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 site associated with the alert.
-
#name ⇒ String
readonly
The name of the site.
-
#tags ⇒ Object
readonly
associated with the Site.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, name: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectSitesResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, name: OMIT, tags: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectSitesResponseBody
33 34 35 36 37 38 39 40 41 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 33 def initialize(id:, name: OMIT, tags: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @tags = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "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.
19 20 21 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 19 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns The ID of the site associated with the alert.
11 12 13 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 11 def id @id end |
#name ⇒ String (readonly)
Returns The name of the site.
13 14 15 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 13 def name @name end |
#tags ⇒ Object (readonly)
associated with the Site.
17 18 19 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 17 def @tags end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertObjectSitesResponseBody
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 46 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"] = parsed_json["tags"]&.map do | item | item = item.to_json Samsara::Types::GoaTagTinyResponseResponseBody.from_json(json_object: item) end new( id: id, name: name, tags: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 74 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.&.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
65 66 67 |
# File 'lib/samsara_api/types/alert_object_sites_response_body.rb', line 65 def to_json @_field_set&.to_json end |