Class: MistApi::WebhookZoneEvent
- Defined in:
- lib/mist_api/models/webhook_zone_event.rb
Overview
WebhookZoneEvent Model.
Instance Attribute Summary collapse
-
#asset_id ⇒ UUID | String
Only if ‘type`==`asset`.
-
#id ⇒ UUID | String
Only if ‘type`==`sdk`.
-
#mac ⇒ String
MAC address of Wi-Fi client, SDK Client or Asset.
-
#map_id ⇒ UUID | String
Map id.
-
#name ⇒ String
Name of the client, may be empty.
-
#site_id ⇒ UUID | String
Name of the client, may be empty.
-
#timestamp ⇒ Float
Epoch (seconds).
-
#trigger ⇒ WebhookZoneEventTriggerEnum
enum: ‘enter`, `exit`.
-
#type ⇒ WebhookZoneEventTypeEnum
Type of client.
-
#zone_id ⇒ UUID | String
Zone id.
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(map_id = nil, site_id = nil, timestamp = nil, trigger = nil, type = nil, zone_id = nil, asset_id = SKIP, id = SKIP, mac = SKIP, name = SKIP) ⇒ WebhookZoneEvent
constructor
A new instance of WebhookZoneEvent.
-
#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(map_id = nil, site_id = nil, timestamp = nil, trigger = nil, type = nil, zone_id = nil, asset_id = SKIP, id = SKIP, mac = SKIP, name = SKIP) ⇒ WebhookZoneEvent
Returns a new instance of WebhookZoneEvent.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 83 def initialize(map_id = nil, site_id = nil, = nil, trigger = nil, type = nil, zone_id = nil, asset_id = SKIP, id = SKIP, mac = SKIP, name = SKIP) @asset_id = asset_id unless asset_id == SKIP @id = id unless id == SKIP @mac = mac unless mac == SKIP @map_id = map_id @name = name unless name == SKIP @site_id = site_id @timestamp = @trigger = trigger @type = type @zone_id = zone_id end |
Instance Attribute Details
#asset_id ⇒ UUID | String
Only if ‘type`==`asset`. UUID of named asset
14 15 16 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 14 def asset_id @asset_id end |
#id ⇒ UUID | String
Only if ‘type`==`sdk`. UUID of the SDK Client
18 19 20 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 18 def id @id end |
#mac ⇒ String
MAC address of Wi-Fi client, SDK Client or Asset
22 23 24 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 22 def mac @mac end |
#map_id ⇒ UUID | String
Map id
26 27 28 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 26 def map_id @map_id end |
#name ⇒ String
Name of the client, may be empty
30 31 32 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 30 def name @name end |
#site_id ⇒ UUID | String
Name of the client, may be empty
34 35 36 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 34 def site_id @site_id end |
#timestamp ⇒ Float
Epoch (seconds)
38 39 40 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 38 def @timestamp end |
#trigger ⇒ WebhookZoneEventTriggerEnum
enum: ‘enter`, `exit`
42 43 44 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 42 def trigger @trigger end |
#type ⇒ WebhookZoneEventTypeEnum
Type of client. enum: ‘asset` (BLE Tag), `sdk`, `wifi`
46 47 48 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 46 def type @type end |
#zone_id ⇒ UUID | String
Zone id
50 51 52 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 50 def zone_id @zone_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 99 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. map_id = hash.key?('map_id') ? hash['map_id'] : nil site_id = hash.key?('site_id') ? hash['site_id'] : nil = hash.key?('timestamp') ? hash['timestamp'] : nil trigger = hash.key?('trigger') ? hash['trigger'] : nil type = hash.key?('type') ? hash['type'] : nil zone_id = hash.key?('zone_id') ? hash['zone_id'] : nil asset_id = hash.key?('asset_id') ? hash['asset_id'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP mac = hash.key?('mac') ? hash['mac'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP # Create object from extracted values. WebhookZoneEvent.new(map_id, site_id, , trigger, type, zone_id, asset_id, id, mac, name) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['asset_id'] = 'asset_id' @_hash['id'] = 'id' @_hash['mac'] = 'mac' @_hash['map_id'] = 'map_id' @_hash['name'] = 'name' @_hash['site_id'] = 'site_id' @_hash['timestamp'] = 'timestamp' @_hash['trigger'] = 'trigger' @_hash['type'] = 'type' @_hash['zone_id'] = 'zone_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 69 def self.optionals %w[ asset_id id mac name ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 129 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.map_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.site_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.trigger, ->(val) { WebhookZoneEventTriggerEnum.validate(val) }) and APIHelper.valid_type?(value.type, ->(val) { WebhookZoneEventTypeEnum.validate(val) }) and APIHelper.valid_type?(value.zone_id, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['map_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['site_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['timestamp'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['trigger'], ->(val) { WebhookZoneEventTriggerEnum.validate(val) }) and APIHelper.valid_type?(value['type'], ->(val) { WebhookZoneEventTypeEnum.validate(val) }) and APIHelper.valid_type?(value['zone_id'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
174 175 176 177 178 179 180 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 174 def inspect class_name = self.class.name.split('::').last "<#{class_name} asset_id: #{@asset_id.inspect}, id: #{@id.inspect}, mac: #{@mac.inspect},"\ " map_id: #{@map_id.inspect}, name: #{@name.inspect}, site_id: #{@site_id.inspect},"\ " timestamp: #{@timestamp.inspect}, trigger: #{@trigger.inspect}, type: #{@type.inspect},"\ " zone_id: #{@zone_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
166 167 168 169 170 171 |
# File 'lib/mist_api/models/webhook_zone_event.rb', line 166 def to_s class_name = self.class.name.split('::').last "<#{class_name} asset_id: #{@asset_id}, id: #{@id}, mac: #{@mac}, map_id: #{@map_id}, name:"\ " #{@name}, site_id: #{@site_id}, timestamp: #{@timestamp}, trigger: #{@trigger}, type:"\ " #{@type}, zone_id: #{@zone_id}>" end |