Class: MistApi::Guest

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

Overview

Guest

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(access_code_email = SKIP, ap_mac = SKIP, auth_method = SKIP, authorized = true, authorized_expiring_time = SKIP, authorized_time = SKIP, company = SKIP, email = SKIP, field1 = SKIP, field2 = SKIP, field3 = SKIP, field4 = SKIP, mac = SKIP, minutes = 1440, name = SKIP, random_mac = SKIP, ssid = SKIP, wlan_id = SKIP, additional_properties = nil) ⇒ Guest

Returns a new instance of Guest.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/mist_api/models/guest.rb', line 140

def initialize(access_code_email = SKIP, ap_mac = SKIP, auth_method = SKIP,
               authorized = true, authorized_expiring_time = SKIP,
               authorized_time = SKIP, company = SKIP, email = SKIP,
               field1 = SKIP, field2 = SKIP, field3 = SKIP, field4 = SKIP,
               mac = SKIP, minutes = 1440, name = SKIP, random_mac = SKIP,
               ssid = SKIP, wlan_id = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @access_code_email = access_code_email unless access_code_email == SKIP
  @ap_mac = ap_mac unless ap_mac == SKIP
  @auth_method = auth_method unless auth_method == SKIP
  @authorized = authorized unless authorized == SKIP
  @authorized_expiring_time = authorized_expiring_time unless authorized_expiring_time == SKIP
  @authorized_time = authorized_time unless authorized_time == SKIP
  @company = company unless company == SKIP
  @email = email unless email == SKIP
  @field1 = field1 unless field1 == SKIP
  @field2 = field2 unless field2 == SKIP
  @field3 = field3 unless field3 == SKIP
  @field4 = field4 unless field4 == SKIP
  @mac = mac unless mac == SKIP
  @minutes = minutes unless minutes == SKIP
  @name = name unless name == SKIP
  @random_mac = random_mac unless random_mac == SKIP
  @ssid = ssid unless ssid == SKIP
  @wlan_id = wlan_id unless wlan_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_code_emailString

If ‘auth_method`==`email`, the email address where the authorization code has been sent to

Returns:

  • (String)


15
16
17
# File 'lib/mist_api/models/guest.rb', line 15

def access_code_email
  @access_code_email
end

#ap_macString

MAC Address of the AP the guest was connected to during the registration process

Returns:

  • (String)


20
21
22
# File 'lib/mist_api/models/guest.rb', line 20

def ap_mac
  @ap_mac
end

#auth_methodString

Type of guest authorization

Returns:

  • (String)


24
25
26
# File 'lib/mist_api/models/guest.rb', line 24

def auth_method
  @auth_method
end

#authorizedTrueClass | FalseClass

Whether the guest is current authorized

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/mist_api/models/guest.rb', line 28

def authorized
  @authorized
end

#authorized_expiring_timeFloat

When the authorization would expire

Returns:

  • (Float)


32
33
34
# File 'lib/mist_api/models/guest.rb', line 32

def authorized_expiring_time
  @authorized_expiring_time
end

#authorized_timeFloat

When the guest was authorized

Returns:

  • (Float)


36
37
38
# File 'lib/mist_api/models/guest.rb', line 36

def authorized_time
  @authorized_time
end

#companyString

Optional, the info provided by user

Returns:

  • (String)


40
41
42
# File 'lib/mist_api/models/guest.rb', line 40

def company
  @company
end

#emailString

Optional, the info provided by user

Returns:

  • (String)


44
45
46
# File 'lib/mist_api/models/guest.rb', line 44

def email
  @email
end

#field1String

Optional, the info provided by user

Returns:

  • (String)


48
49
50
# File 'lib/mist_api/models/guest.rb', line 48

def field1
  @field1
end

#field2String

Optional, the info provided by user

Returns:

  • (String)


52
53
54
# File 'lib/mist_api/models/guest.rb', line 52

def field2
  @field2
end

#field3String

Optional, the info provided by user

Returns:

  • (String)


56
57
58
# File 'lib/mist_api/models/guest.rb', line 56

def field3
  @field3
end

#field4String

Optional, the info provided by user

Returns:

  • (String)


60
61
62
# File 'lib/mist_api/models/guest.rb', line 60

def field4
  @field4
end

#macString

MAC Address

Returns:

  • (String)


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

def mac
  @mac
end

#minutesInteger

Authorization duration, in minutes. Default is 1440 minutes (1 day), maximum is 259200 (180 days)

Returns:

  • (Integer)


69
70
71
# File 'lib/mist_api/models/guest.rb', line 69

def minutes
  @minutes
end

#nameString

Optional, the info provided by user

Returns:

  • (String)


73
74
75
# File 'lib/mist_api/models/guest.rb', line 73

def name
  @name
end

#random_macTrueClass | FalseClass

If the client is using a randomized MAC Address to connect the SSID

Returns:

  • (TrueClass | FalseClass)


77
78
79
# File 'lib/mist_api/models/guest.rb', line 77

def random_mac
  @random_mac
end

#ssidString

Name of the SSID

Returns:

  • (String)


81
82
83
# File 'lib/mist_api/models/guest.rb', line 81

def ssid
  @ssid
end

#wlan_idUUID | String

ID of the SSID

Returns:

  • (UUID | String)


85
86
87
# File 'lib/mist_api/models/guest.rb', line 85

def wlan_id
  @wlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/mist_api/models/guest.rb', line 171

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  access_code_email =
    hash.key?('access_code_email') ? hash['access_code_email'] : SKIP
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : SKIP
  auth_method = hash.key?('auth_method') ? hash['auth_method'] : SKIP
  authorized = hash['authorized'] ||= true
  authorized_expiring_time =
    hash.key?('authorized_expiring_time') ? hash['authorized_expiring_time'] : SKIP
  authorized_time =
    hash.key?('authorized_time') ? hash['authorized_time'] : SKIP
  company = hash.key?('company') ? hash['company'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  field1 = hash.key?('field1') ? hash['field1'] : SKIP
  field2 = hash.key?('field2') ? hash['field2'] : SKIP
  field3 = hash.key?('field3') ? hash['field3'] : SKIP
  field4 = hash.key?('field4') ? hash['field4'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  minutes = hash['minutes'] ||= 1440
  name = hash.key?('name') ? hash['name'] : SKIP
  random_mac = hash.key?('random_mac') ? hash['random_mac'] : SKIP
  ssid = hash.key?('ssid') ? hash['ssid'] : SKIP
  wlan_id = hash.key?('wlan_id') ? hash['wlan_id'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Guest.new(access_code_email,
            ap_mac,
            auth_method,
            authorized,
            authorized_expiring_time,
            authorized_time,
            company,
            email,
            field1,
            field2,
            field3,
            field4,
            mac,
            minutes,
            name,
            random_mac,
            ssid,
            wlan_id,
            additional_properties)
end

.namesObject

A mapping from model property names to API property names.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/mist_api/models/guest.rb', line 88

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['access_code_email'] = 'access_code_email'
  @_hash['ap_mac'] = 'ap_mac'
  @_hash['auth_method'] = 'auth_method'
  @_hash['authorized'] = 'authorized'
  @_hash['authorized_expiring_time'] = 'authorized_expiring_time'
  @_hash['authorized_time'] = 'authorized_time'
  @_hash['company'] = 'company'
  @_hash['email'] = 'email'
  @_hash['field1'] = 'field1'
  @_hash['field2'] = 'field2'
  @_hash['field3'] = 'field3'
  @_hash['field4'] = 'field4'
  @_hash['mac'] = 'mac'
  @_hash['minutes'] = 'minutes'
  @_hash['name'] = 'name'
  @_hash['random_mac'] = 'random_mac'
  @_hash['ssid'] = 'ssid'
  @_hash['wlan_id'] = 'wlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



136
137
138
# File 'lib/mist_api/models/guest.rb', line 136

def self.nullables
  []
end

.optionalsObject

An array for optional fields



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/mist_api/models/guest.rb', line 112

def self.optionals
  %w[
    access_code_email
    ap_mac
    auth_method
    authorized
    authorized_expiring_time
    authorized_time
    company
    email
    field1
    field2
    field3
    field4
    mac
    minutes
    name
    random_mac
    ssid
    wlan_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/mist_api/models/guest.rb', line 239

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} access_code_email: #{@access_code_email.inspect}, ap_mac:"\
  " #{@ap_mac.inspect}, auth_method: #{@auth_method.inspect}, authorized:"\
  " #{@authorized.inspect}, authorized_expiring_time: #{@authorized_expiring_time.inspect},"\
  " authorized_time: #{@authorized_time.inspect}, company: #{@company.inspect}, email:"\
  " #{@email.inspect}, field1: #{@field1.inspect}, field2: #{@field2.inspect}, field3:"\
  " #{@field3.inspect}, field4: #{@field4.inspect}, mac: #{@mac.inspect}, minutes:"\
  " #{@minutes.inspect}, name: #{@name.inspect}, random_mac: #{@random_mac.inspect}, ssid:"\
  " #{@ssid.inspect}, wlan_id: #{@wlan_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



227
228
229
230
231
232
233
234
235
236
# File 'lib/mist_api/models/guest.rb', line 227

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} access_code_email: #{@access_code_email}, ap_mac: #{@ap_mac}, auth_method:"\
  " #{@auth_method}, authorized: #{@authorized}, authorized_expiring_time:"\
  " #{@authorized_expiring_time}, authorized_time: #{@authorized_time}, company: #{@company},"\
  " email: #{@email}, field1: #{@field1}, field2: #{@field2}, field3: #{@field3}, field4:"\
  " #{@field4}, mac: #{@mac}, minutes: #{@minutes}, name: #{@name}, random_mac:"\
  " #{@random_mac}, ssid: #{@ssid}, wlan_id: #{@wlan_id}, additional_properties:"\
  " #{@additional_properties}>"
end