Class: MistApi::Site

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

Overview

Site

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(name = nil, address = SKIP, alarmtemplate_id = SKIP, aptemplate_id = SKIP, country_code = SKIP, created_time = SKIP, gatewaytemplate_id = SKIP, id = SKIP, latlng = SKIP, modified_time = SKIP, networktemplate_id = SKIP, notes = SKIP, org_id = SKIP, rftemplate_id = SKIP, routertemplate_id = SKIP, secpolicy_id = SKIP, sitegroup_ids = SKIP, sitetemplate_id = SKIP, timezone = 'UTC', tzoffset = 0, additional_properties = nil) ⇒ Site

Returns a new instance of Site.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/mist_api/models/site.rb', line 160

def initialize(name = nil, address = SKIP, alarmtemplate_id = SKIP,
               aptemplate_id = SKIP, country_code = SKIP,
               created_time = SKIP, gatewaytemplate_id = SKIP, id = SKIP,
               latlng = SKIP, modified_time = SKIP,
               networktemplate_id = SKIP, notes = SKIP, org_id = SKIP,
               rftemplate_id = SKIP, routertemplate_id = SKIP,
               secpolicy_id = SKIP, sitegroup_ids = SKIP,
               sitetemplate_id = SKIP, timezone = 'UTC', tzoffset = 0,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address = address unless address == SKIP
  @alarmtemplate_id = alarmtemplate_id unless alarmtemplate_id == SKIP
  @aptemplate_id = aptemplate_id unless aptemplate_id == SKIP
  @country_code = country_code unless country_code == SKIP
  @created_time = created_time unless created_time == SKIP
  @gatewaytemplate_id = gatewaytemplate_id unless gatewaytemplate_id == SKIP
  @id = id unless id == SKIP
  @latlng = latlng unless latlng == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name
  @networktemplate_id = networktemplate_id unless networktemplate_id == SKIP
  @notes = notes unless notes == SKIP
  @org_id = org_id unless org_id == SKIP
  @rftemplate_id = rftemplate_id unless rftemplate_id == SKIP
  @routertemplate_id = routertemplate_id unless routertemplate_id == SKIP
  @secpolicy_id = secpolicy_id unless secpolicy_id == SKIP
  @sitegroup_ids = sitegroup_ids unless sitegroup_ids == SKIP
  @sitetemplate_id = sitetemplate_id unless sitetemplate_id == SKIP
  @timezone = timezone unless timezone == SKIP
  @tzoffset = tzoffset unless tzoffset == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressString

full address of the site

Returns:

  • (String)


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

def address
  @address
end

#alarmtemplate_idUUID | String

Alarm Template ID, this takes precedence over the Org-level alarmtemplate_id

Returns:

  • (UUID | String)


19
20
21
# File 'lib/mist_api/models/site.rb', line 19

def alarmtemplate_id
  @alarmtemplate_id
end

#aptemplate_idUUID | String

AP Template ID, used by APs

Returns:

  • (UUID | String)


23
24
25
# File 'lib/mist_api/models/site.rb', line 23

def aptemplate_id
  @aptemplate_id
end

#country_codeString

Country code for the site (for AP config generation), in two-character

Returns:

  • (String)


27
28
29
# File 'lib/mist_api/models/site.rb', line 27

def country_code
  @country_code
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


31
32
33
# File 'lib/mist_api/models/site.rb', line 31

def created_time
  @created_time
end

#gatewaytemplate_idUUID | String

Gateway Template ID, used by gateways

Returns:

  • (UUID | String)


35
36
37
# File 'lib/mist_api/models/site.rb', line 35

def gatewaytemplate_id
  @gatewaytemplate_id
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


39
40
41
# File 'lib/mist_api/models/site.rb', line 39

def id
  @id
end

#latlngLatLng

Unique ID of the object instance in the Mist Organization

Returns:



43
44
45
# File 'lib/mist_api/models/site.rb', line 43

def latlng
  @latlng
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


47
48
49
# File 'lib/mist_api/models/site.rb', line 47

def modified_time
  @modified_time
end

#nameString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


51
52
53
# File 'lib/mist_api/models/site.rb', line 51

def name
  @name
end

#networktemplate_idUUID | String

Network Template ID, this takes precedence over Site Settings

Returns:

  • (UUID | String)


55
56
57
# File 'lib/mist_api/models/site.rb', line 55

def networktemplate_id
  @networktemplate_id
end

#notesString

Optional, any notes about the site

Returns:

  • (String)


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

def notes
  @notes
end

#org_idUUID | String

Optional, any notes about the site

Returns:

  • (UUID | String)


63
64
65
# File 'lib/mist_api/models/site.rb', line 63

def org_id
  @org_id
end

#rftemplate_idUUID | String

RF Template ID, this takes precedence over Site Settings

Returns:

  • (UUID | String)


67
68
69
# File 'lib/mist_api/models/site.rb', line 67

def rftemplate_id
  @rftemplate_id
end

#routertemplate_idUUID | String

Router Template ID, used by gateways

Returns:

  • (UUID | String)


71
72
73
# File 'lib/mist_api/models/site.rb', line 71

def routertemplate_id
  @routertemplate_id
end

#secpolicy_idUUID | String

SecPolicy ID

Returns:

  • (UUID | String)


75
76
77
# File 'lib/mist_api/models/site.rb', line 75

def secpolicy_id
  @secpolicy_id
end

#sitegroup_idsArray[UUID | String]

Sitegroups this site belongs to

Returns:

  • (Array[UUID | String])


79
80
81
# File 'lib/mist_api/models/site.rb', line 79

def sitegroup_ids
  @sitegroup_ids
end

#sitetemplate_idUUID | String

Site Template ID

Returns:

  • (UUID | String)


83
84
85
# File 'lib/mist_api/models/site.rb', line 83

def sitetemplate_id
  @sitetemplate_id
end

#timezoneString

Timezone the site is at

Returns:

  • (String)


87
88
89
# File 'lib/mist_api/models/site.rb', line 87

def timezone
  @timezone
end

#tzoffsetInteger

Timezone the site is at

Returns:

  • (Integer)


91
92
93
# File 'lib/mist_api/models/site.rb', line 91

def tzoffset
  @tzoffset
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/mist_api/models/site.rb', line 196

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  address = hash.key?('address') ? hash['address'] : SKIP
  alarmtemplate_id =
    hash.key?('alarmtemplate_id') ? hash['alarmtemplate_id'] : SKIP
  aptemplate_id = hash.key?('aptemplate_id') ? hash['aptemplate_id'] : SKIP
  country_code = hash.key?('country_code') ? hash['country_code'] : SKIP
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  gatewaytemplate_id =
    hash.key?('gatewaytemplate_id') ? hash['gatewaytemplate_id'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  latlng = LatLng.from_hash(hash['latlng']) if hash['latlng']
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  networktemplate_id =
    hash.key?('networktemplate_id') ? hash['networktemplate_id'] : SKIP
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  rftemplate_id = hash.key?('rftemplate_id') ? hash['rftemplate_id'] : SKIP
  routertemplate_id =
    hash.key?('routertemplate_id') ? hash['routertemplate_id'] : SKIP
  secpolicy_id = hash.key?('secpolicy_id') ? hash['secpolicy_id'] : SKIP
  sitegroup_ids = hash.key?('sitegroup_ids') ? hash['sitegroup_ids'] : SKIP
  sitetemplate_id =
    hash.key?('sitetemplate_id') ? hash['sitetemplate_id'] : SKIP
  timezone = hash['timezone'] ||= 'UTC'
  tzoffset = hash['tzoffset'] ||= 0

  # 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.
  Site.new(name,
           address,
           alarmtemplate_id,
           aptemplate_id,
           country_code,
           created_time,
           gatewaytemplate_id,
           id,
           latlng,
           modified_time,
           networktemplate_id,
           notes,
           org_id,
           rftemplate_id,
           routertemplate_id,
           secpolicy_id,
           sitegroup_ids,
           sitetemplate_id,
           timezone,
           tzoffset,
           additional_properties)
end

.namesObject

A mapping from model property names to API property names.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/mist_api/models/site.rb', line 94

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['alarmtemplate_id'] = 'alarmtemplate_id'
  @_hash['aptemplate_id'] = 'aptemplate_id'
  @_hash['country_code'] = 'country_code'
  @_hash['created_time'] = 'created_time'
  @_hash['gatewaytemplate_id'] = 'gatewaytemplate_id'
  @_hash['id'] = 'id'
  @_hash['latlng'] = 'latlng'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['networktemplate_id'] = 'networktemplate_id'
  @_hash['notes'] = 'notes'
  @_hash['org_id'] = 'org_id'
  @_hash['rftemplate_id'] = 'rftemplate_id'
  @_hash['routertemplate_id'] = 'routertemplate_id'
  @_hash['secpolicy_id'] = 'secpolicy_id'
  @_hash['sitegroup_ids'] = 'sitegroup_ids'
  @_hash['sitetemplate_id'] = 'sitetemplate_id'
  @_hash['timezone'] = 'timezone'
  @_hash['tzoffset'] = 'tzoffset'
  @_hash
end

.nullablesObject

An array for nullable fields



145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/mist_api/models/site.rb', line 145

def self.nullables
  %w[
    address
    alarmtemplate_id
    aptemplate_id
    gatewaytemplate_id
    networktemplate_id
    notes
    rftemplate_id
    routertemplate_id
    secpolicy_id
    sitetemplate_id
  ]
end

.optionalsObject

An array for optional fields



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/mist_api/models/site.rb', line 120

def self.optionals
  %w[
    address
    alarmtemplate_id
    aptemplate_id
    country_code
    created_time
    gatewaytemplate_id
    id
    latlng
    modified_time
    networktemplate_id
    notes
    org_id
    rftemplate_id
    routertemplate_id
    secpolicy_id
    sitegroup_ids
    sitetemplate_id
    timezone
    tzoffset
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/mist_api/models/site.rb', line 272

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, alarmtemplate_id:"\
  " #{@alarmtemplate_id.inspect}, aptemplate_id: #{@aptemplate_id.inspect}, country_code:"\
  " #{@country_code.inspect}, created_time: #{@created_time.inspect}, gatewaytemplate_id:"\
  " #{@gatewaytemplate_id.inspect}, id: #{@id.inspect}, latlng: #{@latlng.inspect},"\
  " modified_time: #{@modified_time.inspect}, name: #{@name.inspect}, networktemplate_id:"\
  " #{@networktemplate_id.inspect}, notes: #{@notes.inspect}, org_id: #{@org_id.inspect},"\
  " rftemplate_id: #{@rftemplate_id.inspect}, routertemplate_id:"\
  " #{@routertemplate_id.inspect}, secpolicy_id: #{@secpolicy_id.inspect}, sitegroup_ids:"\
  " #{@sitegroup_ids.inspect}, sitetemplate_id: #{@sitetemplate_id.inspect}, timezone:"\
  " #{@timezone.inspect}, tzoffset: #{@tzoffset.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/mist_api/models/site.rb', line 258

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address}, alarmtemplate_id: #{@alarmtemplate_id},"\
  " aptemplate_id: #{@aptemplate_id}, country_code: #{@country_code}, created_time:"\
  " #{@created_time}, gatewaytemplate_id: #{@gatewaytemplate_id}, id: #{@id}, latlng:"\
  " #{@latlng}, modified_time: #{@modified_time}, name: #{@name}, networktemplate_id:"\
  " #{@networktemplate_id}, notes: #{@notes}, org_id: #{@org_id}, rftemplate_id:"\
  " #{@rftemplate_id}, routertemplate_id: #{@routertemplate_id}, secpolicy_id:"\
  " #{@secpolicy_id}, sitegroup_ids: #{@sitegroup_ids}, sitetemplate_id: #{@sitetemplate_id},"\
  " timezone: #{@timezone}, tzoffset: #{@tzoffset}, additional_properties:"\
  " #{@additional_properties}>"
end