Class: MistApi::WebhookOccupancyAlertsEventAlertEventsItems

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb

Overview

WebhookOccupancyAlertsEventAlertEventsItems Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(current_occupancy = nil, map_id = nil, occupancy_limit = nil, org_id = nil, timestamp = nil, type = nil, zone_id = nil, zone_name = nil) ⇒ WebhookOccupancyAlertsEventAlertEventsItems

Returns a new instance of WebhookOccupancyAlertsEventAlertEventsItems.



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 68

def initialize(current_occupancy = nil, map_id = nil, occupancy_limit = nil,
               org_id = nil, timestamp = nil, type = nil, zone_id = nil,
               zone_name = nil)
  @current_occupancy = current_occupancy
  @map_id = map_id
  @occupancy_limit = occupancy_limit
  @org_id = org_id
  @timestamp = timestamp
  @type = type
  @zone_id = zone_id
  @zone_name = zone_name
end

Instance Attribute Details

#current_occupancyInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 14

def current_occupancy
  @current_occupancy
end

#map_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


18
19
20
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 18

def map_id
  @map_id
end

#occupancy_limitInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 22

def occupancy_limit
  @occupancy_limit
end

#org_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


26
27
28
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 26

def org_id
  @org_id
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


30
31
32
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 30

def timestamp
  @timestamp
end

#typeWebhookOccupancyAlertTypeEnum

enum: ‘COMPLIANCE-OK`, `COMPLIANCE-VIOLATION`



34
35
36
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 34

def type
  @type
end

#zone_idUUID | String

enum: ‘COMPLIANCE-OK`, `COMPLIANCE-VIOLATION`

Returns:

  • (UUID | String)


38
39
40
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 38

def zone_id
  @zone_id
end

#zone_nameString

enum: ‘COMPLIANCE-OK`, `COMPLIANCE-VIOLATION`

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 42

def zone_name
  @zone_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  current_occupancy =
    hash.key?('current_occupancy') ? hash['current_occupancy'] : nil
  map_id = hash.key?('map_id') ? hash['map_id'] : nil
  occupancy_limit =
    hash.key?('occupancy_limit') ? hash['occupancy_limit'] : nil
  org_id = hash.key?('org_id') ? hash['org_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  zone_id = hash.key?('zone_id') ? hash['zone_id'] : nil
  zone_name = hash.key?('zone_name') ? hash['zone_name'] : nil

  # Create object from extracted values.
  WebhookOccupancyAlertsEventAlertEventsItems.new(current_occupancy,
                                                  map_id,
                                                  occupancy_limit,
                                                  org_id,
                                                  timestamp,
                                                  type,
                                                  zone_id,
                                                  zone_name)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['current_occupancy'] = 'current_occupancy'
  @_hash['map_id'] = 'map_id'
  @_hash['occupancy_limit'] = 'occupancy_limit'
  @_hash['org_id'] = 'org_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['zone_id'] = 'zone_id'
  @_hash['zone_name'] = 'zone_name'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 59

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 110

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.current_occupancy,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.map_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.occupancy_limit,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.org_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.timestamp,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { WebhookOccupancyAlertTypeEnum.validate(val) }) and
        APIHelper.valid_type?(value.zone_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.zone_name,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['current_occupancy'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['map_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['occupancy_limit'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['org_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['timestamp'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { WebhookOccupancyAlertTypeEnum.validate(val) }) and
      APIHelper.valid_type?(value['zone_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['zone_name'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} current_occupancy: #{@current_occupancy.inspect}, map_id:"\
  " #{@map_id.inspect}, occupancy_limit: #{@occupancy_limit.inspect}, org_id:"\
  " #{@org_id.inspect}, timestamp: #{@timestamp.inspect}, type: #{@type.inspect}, zone_id:"\
  " #{@zone_id.inspect}, zone_name: #{@zone_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
# File 'lib/mist_api/models/webhook_occupancy_alerts_event_alert_events_items.rb', line 155

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} current_occupancy: #{@current_occupancy}, map_id: #{@map_id},"\
  " occupancy_limit: #{@occupancy_limit}, org_id: #{@org_id}, timestamp: #{@timestamp}, type:"\
  " #{@type}, zone_id: #{@zone_id}, zone_name: #{@zone_name}>"
end