Class: MistApi::WebhookOccupancyAlertsEvent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- MistApi::WebhookOccupancyAlertsEvent
- Defined in:
- lib/mist_api/models/webhook_occupancy_alerts_event.rb
Overview
WebhookOccupancyAlertsEvent Model.
Instance Attribute Summary collapse
-
#alert_events ⇒ Array[WebhookOccupancyAlertsEventAlertEventsItems]
List of occupancy alerts for non-compliance zones within the site detected around the same time.
-
#for_site ⇒ TrueClass | FalseClass
List of occupancy alerts for non-compliance zones within the site detected around the same time.
-
#site_id ⇒ UUID | String
List of occupancy alerts for non-compliance zones within the site detected around the same time.
-
#site_name ⇒ String
List of occupancy alerts for non-compliance zones within the site detected around the same time.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(site_id = nil, site_name = nil, alert_events = SKIP, for_site = SKIP) ⇒ WebhookOccupancyAlertsEvent
constructor
A new instance of WebhookOccupancyAlertsEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(site_id = nil, site_name = nil, alert_events = SKIP, for_site = SKIP) ⇒ WebhookOccupancyAlertsEvent
Returns a new instance of WebhookOccupancyAlertsEvent.
55 56 57 58 59 60 61 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 55 def initialize(site_id = nil, site_name = nil, alert_events = SKIP, for_site = SKIP) @alert_events = alert_events unless alert_events == SKIP @for_site = for_site unless for_site == SKIP @site_id = site_id @site_name = site_name end |
Instance Attribute Details
#alert_events ⇒ Array[WebhookOccupancyAlertsEventAlertEventsItems]
List of occupancy alerts for non-compliance zones within the site detected around the same time
15 16 17 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 15 def alert_events @alert_events end |
#for_site ⇒ TrueClass | FalseClass
List of occupancy alerts for non-compliance zones within the site detected around the same time
20 21 22 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 20 def for_site @for_site end |
#site_id ⇒ UUID | String
List of occupancy alerts for non-compliance zones within the site detected around the same time
25 26 27 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 25 def site_id @site_id end |
#site_name ⇒ String
List of occupancy alerts for non-compliance zones within the site detected around the same time
30 31 32 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 30 def site_name @site_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. site_id = hash.key?('site_id') ? hash['site_id'] : nil site_name = hash.key?('site_name') ? hash['site_name'] : nil # Parameter is an array, so we need to iterate through it alert_events = nil unless hash['alert_events'].nil? alert_events = [] hash['alert_events'].each do |structure| alert_events << (WebhookOccupancyAlertsEventAlertEventsItems.from_hash(structure) if structure) end end alert_events = SKIP unless hash.key?('alert_events') for_site = hash.key?('for_site') ? hash['for_site'] : SKIP # Create object from extracted values. WebhookOccupancyAlertsEvent.new(site_id, site_name, alert_events, for_site) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['alert_events'] = 'alert_events' @_hash['for_site'] = 'for_site' @_hash['site_id'] = 'site_id' @_hash['site_name'] = 'site_name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 43 def self.optionals %w[ alert_events for_site ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 91 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.site_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.site_name, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['site_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['site_name'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} alert_events: #{@alert_events.inspect}, for_site: #{@for_site.inspect},"\ " site_id: #{@site_id.inspect}, site_name: #{@site_name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 |
# File 'lib/mist_api/models/webhook_occupancy_alerts_event.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} alert_events: #{@alert_events}, for_site: #{@for_site}, site_id:"\ " #{@site_id}, site_name: #{@site_name}>" end |