dashboard-api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +34 -0
- data/.gitignore +5 -4
- data/.travis.yml +20 -0
- data/Gemfile +9 -5
- data/Gemfile.lock +63 -31
- data/README.md +134 -138
- data/Rakefile +9 -7
- data/dashboard-api.gemspec +28 -28
- data/doc/Admins.html +603 -603
- data/doc/Clients.html +276 -276
- data/doc/DashboardAPI.html +603 -603
- data/doc/DashboardAPIVersion.html +159 -159
- data/doc/Devices.html +879 -879
- data/doc/Networks.html +1382 -1382
- data/doc/Organizations.html +1477 -1477
- data/doc/Phones.html +641 -641
- data/doc/SAML.html +758 -758
- data/doc/SSIDs.html +523 -523
- data/doc/Switchports.html +526 -526
- data/doc/Templates.html +378 -378
- data/doc/VLANs.html +762 -762
- data/doc/_index.html +235 -235
- data/doc/class_list.html +51 -51
- data/doc/css/full_list.css +58 -58
- data/doc/css/style.css +481 -481
- data/doc/file.README.html +248 -248
- data/doc/file_list.html +56 -56
- data/doc/frames.html +17 -17
- data/doc/index.html +248 -248
- data/doc/js/app.js +243 -243
- data/doc/js/full_list.js +216 -216
- data/doc/js/jquery.js +3 -3
- data/doc/method_list.html +523 -523
- data/doc/top-level-namespace.html +113 -113
- data/lib/admins.rb +37 -37
- data/lib/clients.rb +12 -12
- data/lib/dashboard-api.rb +82 -83
- data/lib/dashboard-api/version.rb +6 -6
- data/lib/devices.rb +57 -57
- data/lib/networks.rb +108 -108
- data/lib/organizations.rb +110 -115
- data/lib/phones.rb +40 -40
- data/lib/saml.rb +47 -47
- data/lib/ssids.rb +33 -33
- data/lib/switchports.rb +33 -33
- data/lib/templates.rb +18 -18
- data/lib/vlans.rb +49 -49
- metadata +7 -5
data/doc/DashboardAPI.html
CHANGED
@@ -1,604 +1,604 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: DashboardAPI
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.5
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "DashboardAPI";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="class_list.html"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index (D)</a> »
|
40
|
-
|
41
|
-
|
42
|
-
<span class="title">DashboardAPI</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<iframe id="search_frame" src="class_list.html"></iframe>
|
63
|
-
|
64
|
-
<div id="content"><h1>Class: DashboardAPI
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
</h1>
|
69
|
-
<div class="box_info">
|
70
|
-
|
71
|
-
<dl>
|
72
|
-
<dt>Inherits:</dt>
|
73
|
-
<dd>
|
74
|
-
<span class="inheritName">Object</span>
|
75
|
-
|
76
|
-
<ul class="fullTree">
|
77
|
-
<li>Object</li>
|
78
|
-
|
79
|
-
<li class="next">DashboardAPI</li>
|
80
|
-
|
81
|
-
</ul>
|
82
|
-
<a href="#" class="inheritanceTree">show all</a>
|
83
|
-
|
84
|
-
</dd>
|
85
|
-
</dl>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
<dl>
|
93
|
-
<dt>Includes:</dt>
|
94
|
-
<dd><span class='object_link'><a href="Admins.html" title="Admins (module)">Admins</a></span>, <span class='object_link'><a href="Clients.html" title="Clients (module)">Clients</a></span>, <span class='object_link'><a href="DashboardAPIVersion.html" title="DashboardAPIVersion (module)">DashboardAPIVersion</a></span>, <span class='object_link'><a href="Devices.html" title="Devices (module)">Devices</a></span>, HTTParty, <span class='object_link'><a href="Networks.html" title="Networks (module)">Networks</a></span>, <span class='object_link'><a href="Organizations.html" title="Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Phones.html" title="Phones (module)">Phones</a></span>, <span class='object_link'><a href="SAML.html" title="SAML (module)">SAML</a></span>, <span class='object_link'><a href="SSIDs.html" title="SSIDs (module)">SSIDs</a></span>, <span class='object_link'><a href="Switchports.html" title="Switchports (module)">Switchports</a></span>, <span class='object_link'><a href="Templates.html" title="Templates (module)">Templates</a></span>, <span class='object_link'><a href="VLANs.html" title="VLANs (module)">VLANs</a></span></dd>
|
95
|
-
</dl>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<dl>
|
103
|
-
<dt>Defined in:</dt>
|
104
|
-
<dd>lib/dashboard-api.rb</dd>
|
105
|
-
</dl>
|
106
|
-
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<h2>Overview</h2><div class="docstring">
|
110
|
-
<div class="discussion">
|
111
|
-
|
112
|
-
<p>Ruby Implementation of the Meraki Dashboard api</p>
|
113
|
-
|
114
|
-
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
<div class="tags">
|
118
|
-
|
119
|
-
<p class="tag_title">Author:</p>
|
120
|
-
<ul class="author">
|
121
|
-
|
122
|
-
<li>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
<div class='inline'>
|
129
|
-
<p>Joe Letizia</p>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
</li>
|
133
|
-
|
134
|
-
</ul>
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
|
139
|
-
<h2>Constant Summary</h2>
|
140
|
-
|
141
|
-
<h3 class="inherited">Constants included
|
142
|
-
from <span class='object_link'><a href="DashboardAPIVersion.html" title="DashboardAPIVersion (module)">DashboardAPIVersion</a></span></h3>
|
143
|
-
<p class="inherited"><span class='object_link'><a href="DashboardAPIVersion.html#VERSION-constant" title="DashboardAPIVersion::VERSION (constant)">DashboardAPIVersion::VERSION</a></span></p>
|
144
|
-
|
145
|
-
|
146
|
-
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
147
|
-
<ul class="summary">
|
148
|
-
|
149
|
-
<li class="public ">
|
150
|
-
<span class="summary_signature">
|
151
|
-
|
152
|
-
<a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> ⇒ Object </a>
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
</span>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
<span class="note title readonly">readonly</span>
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
<span class="summary_desc"><div class='inline'>
|
172
|
-
<p>Returns the value of attribute key.</p>
|
173
|
-
</div></span>
|
174
|
-
|
175
|
-
</li>
|
176
|
-
|
177
|
-
|
178
|
-
</ul>
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<h2>
|
185
|
-
Instance Method Summary
|
186
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
187
|
-
</h2>
|
188
|
-
|
189
|
-
<ul class="summary">
|
190
|
-
|
191
|
-
<li class="public ">
|
192
|
-
<span class="summary_signature">
|
193
|
-
|
194
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(key) ⇒ DashboardAPI </a>
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
</span>
|
199
|
-
|
200
|
-
|
201
|
-
<span class="note title constructor">constructor</span>
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
<span class="summary_desc"><div class='inline'>
|
211
|
-
<p>A new instance of DashboardAPI.</p>
|
212
|
-
</div></span>
|
213
|
-
|
214
|
-
</li>
|
215
|
-
|
216
|
-
|
217
|
-
<li class="public ">
|
218
|
-
<span class="summary_signature">
|
219
|
-
|
220
|
-
<a href="#make_api_call-instance_method" title="#make_api_call (instance method)">#<strong>make_api_call</strong>(endpoint_url, http_method, options_hash = {}) ⇒ Object </a>
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
</span>
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
<span class="summary_desc"><div class='inline'>
|
235
|
-
<p>Inner function, not to be called directly.</p>
|
236
|
-
</div></span>
|
237
|
-
|
238
|
-
</li>
|
239
|
-
|
240
|
-
|
241
|
-
</ul>
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="SAML.html" title="SAML (module)">SAML</a></span></h3>
|
254
|
-
<p class="inherited"><span class='object_link'><a href="SAML.html#create_saml_role-instance_method" title="SAML#create_saml_role (method)">#create_saml_role</a></span>, <span class='object_link'><a href="SAML.html#list_saml_roles-instance_method" title="SAML#list_saml_roles (method)">#list_saml_roles</a></span>, <span class='object_link'><a href="SAML.html#remove_saml_role-instance_method" title="SAML#remove_saml_role (method)">#remove_saml_role</a></span>, <span class='object_link'><a href="SAML.html#return_saml_role-instance_method" title="SAML#return_saml_role (method)">#return_saml_role</a></span>, <span class='object_link'><a href="SAML.html#update_saml_role-instance_method" title="SAML#update_saml_role (method)">#update_saml_role</a></span></p>
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Templates.html" title="Templates (module)">Templates</a></span></h3>
|
265
|
-
<p class="inherited"><span class='object_link'><a href="Templates.html#list_templates-instance_method" title="Templates#list_templates (method)">#list_templates</a></span>, <span class='object_link'><a href="Templates.html#remove_template-instance_method" title="Templates#remove_template (method)">#remove_template</a></span></p>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Phones.html" title="Phones (module)">Phones</a></span></h3>
|
276
|
-
<p class="inherited"><span class='object_link'><a href="Phones.html#add_phone_contact-instance_method" title="Phones#add_phone_contact (method)">#add_phone_contact</a></span>, <span class='object_link'><a href="Phones.html#delete_phone_contact-instance_method" title="Phones#delete_phone_contact (method)">#delete_phone_contact</a></span>, <span class='object_link'><a href="Phones.html#list_phone_contacts-instance_method" title="Phones#list_phone_contacts (method)">#list_phone_contacts</a></span>, <span class='object_link'><a href="Phones.html#update_phone_contact-instance_method" title="Phones#update_phone_contact (method)">#update_phone_contact</a></span></p>
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="VLANs.html" title="VLANs (module)">VLANs</a></span></h3>
|
287
|
-
<p class="inherited"><span class='object_link'><a href="VLANs.html#add_vlan-instance_method" title="VLANs#add_vlan (method)">#add_vlan</a></span>, <span class='object_link'><a href="VLANs.html#delete_vlan-instance_method" title="VLANs#delete_vlan (method)">#delete_vlan</a></span>, <span class='object_link'><a href="VLANs.html#list_vlans-instance_method" title="VLANs#list_vlans (method)">#list_vlans</a></span>, <span class='object_link'><a href="VLANs.html#return_vlan-instance_method" title="VLANs#return_vlan (method)">#return_vlan</a></span>, <span class='object_link'><a href="VLANs.html#update_vlan-instance_method" title="VLANs#update_vlan (method)">#update_vlan</a></span></p>
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Switchports.html" title="Switchports (module)">Switchports</a></span></h3>
|
298
|
-
<p class="inherited"><span class='object_link'><a href="Switchports.html#get_single_switch_port-instance_method" title="Switchports#get_single_switch_port (method)">#get_single_switch_port</a></span>, <span class='object_link'><a href="Switchports.html#get_switch_ports-instance_method" title="Switchports#get_switch_ports (method)">#get_switch_ports</a></span>, <span class='object_link'><a href="Switchports.html#update_switchport-instance_method" title="Switchports#update_switchport (method)">#update_switchport</a></span></p>
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Admins.html" title="Admins (module)">Admins</a></span></h3>
|
309
|
-
<p class="inherited"><span class='object_link'><a href="Admins.html#add_admin-instance_method" title="Admins#add_admin (method)">#add_admin</a></span>, <span class='object_link'><a href="Admins.html#list_admins-instance_method" title="Admins#list_admins (method)">#list_admins</a></span>, <span class='object_link'><a href="Admins.html#revoke_admin-instance_method" title="Admins#revoke_admin (method)">#revoke_admin</a></span>, <span class='object_link'><a href="Admins.html#update_admin-instance_method" title="Admins#update_admin (method)">#update_admin</a></span></p>
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="SSIDs.html" title="SSIDs (module)">SSIDs</a></span></h3>
|
320
|
-
<p class="inherited"><span class='object_link'><a href="SSIDs.html#get_single_ssid-instance_method" title="SSIDs#get_single_ssid (method)">#get_single_ssid</a></span>, <span class='object_link'><a href="SSIDs.html#list_ssids_in_network-instance_method" title="SSIDs#list_ssids_in_network (method)">#list_ssids_in_network</a></span>, <span class='object_link'><a href="SSIDs.html#update_single_ssid-instance_method" title="SSIDs#update_single_ssid (method)">#update_single_ssid</a></span></p>
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Devices.html" title="Devices (module)">Devices</a></span></h3>
|
331
|
-
<p class="inherited"><span class='object_link'><a href="Devices.html#claim_device_into_network-instance_method" title="Devices#claim_device_into_network (method)">#claim_device_into_network</a></span>, <span class='object_link'><a href="Devices.html#get_device_uplink_stats-instance_method" title="Devices#get_device_uplink_stats (method)">#get_device_uplink_stats</a></span>, <span class='object_link'><a href="Devices.html#get_single_device-instance_method" title="Devices#get_single_device (method)">#get_single_device</a></span>, <span class='object_link'><a href="Devices.html#list_devices_in_network-instance_method" title="Devices#list_devices_in_network (method)">#list_devices_in_network</a></span>, <span class='object_link'><a href="Devices.html#remove_device_from_network-instance_method" title="Devices#remove_device_from_network (method)">#remove_device_from_network</a></span>, <span class='object_link'><a href="Devices.html#update_device_attributes-instance_method" title="Devices#update_device_attributes (method)">#update_device_attributes</a></span></p>
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Clients.html" title="Clients (module)">Clients</a></span></h3>
|
342
|
-
<p class="inherited"><span class='object_link'><a href="Clients.html#get_client_info_for_device-instance_method" title="Clients#get_client_info_for_device (method)">#get_client_info_for_device</a></span></p>
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Networks.html" title="Networks (module)">Networks</a></span></h3>
|
353
|
-
<p class="inherited"><span class='object_link'><a href="Networks.html#bind_network_to_template-instance_method" title="Networks#bind_network_to_template (method)">#bind_network_to_template</a></span>, <span class='object_link'><a href="Networks.html#create_network-instance_method" title="Networks#create_network (method)">#create_network</a></span>, <span class='object_link'><a href="Networks.html#delete_network-instance_method" title="Networks#delete_network (method)">#delete_network</a></span>, <span class='object_link'><a href="Networks.html#get_auto_vpn_settings-instance_method" title="Networks#get_auto_vpn_settings (method)">#get_auto_vpn_settings</a></span>, <span class='object_link'><a href="Networks.html#get_ms_access_policies-instance_method" title="Networks#get_ms_access_policies (method)">#get_ms_access_policies</a></span>, <span class='object_link'><a href="Networks.html#get_networks-instance_method" title="Networks#get_networks (method)">#get_networks</a></span>, <span class='object_link'><a href="Networks.html#get_single_network-instance_method" title="Networks#get_single_network (method)">#get_single_network</a></span>, <span class='object_link'><a href="Networks.html#traffic_analysis-instance_method" title="Networks#traffic_analysis (method)">#traffic_analysis</a></span>, <span class='object_link'><a href="Networks.html#unbind_network_to_template-instance_method" title="Networks#unbind_network_to_template (method)">#unbind_network_to_template</a></span>, <span class='object_link'><a href="Networks.html#update_auto_vpn_settings-instance_method" title="Networks#update_auto_vpn_settings (method)">#update_auto_vpn_settings</a></span>, <span class='object_link'><a href="Networks.html#update_network-instance_method" title="Networks#update_network (method)">#update_network</a></span></p>
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Organizations.html" title="Organizations (module)">Organizations</a></span></h3>
|
370
|
-
<p class="inherited"><span class='object_link'><a href="Organizations.html#claim-instance_method" title="Organizations#claim (method)">#claim</a></span>, <span class='object_link'><a href="Organizations.html#clone_organization-instance_method" title="Organizations#clone_organization (method)">#clone_organization</a></span>, <span class='object_link'><a href="Organizations.html#create_organization-instance_method" title="Organizations#create_organization (method)">#create_organization</a></span>, <span class='object_link'><a href="Organizations.html#get_inventory-instance_method" title="Organizations#get_inventory (method)">#get_inventory</a></span>, <span class='object_link'><a href="Organizations.html#get_license_state-instance_method" title="Organizations#get_license_state (method)">#get_license_state</a></span>, <span class='object_link'><a href="Organizations.html#get_organization-instance_method" title="Organizations#get_organization (method)">#get_organization</a></span>, <span class='object_link'><a href="Organizations.html#get_snmp_settings-instance_method" title="Organizations#get_snmp_settings (method)">#get_snmp_settings</a></span>, <span class='object_link'><a href="Organizations.html#get_third_party_peers-instance_method" title="Organizations#get_third_party_peers (method)">#get_third_party_peers</a></span>, <span class='object_link'><a href="Organizations.html#list_all_organizations-instance_method" title="Organizations#list_all_organizations (method)">#list_all_organizations</a></span>, <span class='object_link'><a href="Organizations.html#update_organization-instance_method" title="Organizations#update_organization (method)">#update_organization</a></span>, <span class='object_link'><a href="Organizations.html#update_snmp_settings-instance_method" title="Organizations#update_snmp_settings (method)">#update_snmp_settings</a></span>, <span class='object_link'><a href="Organizations.html#update_third_party_peers-instance_method" title="Organizations#update_third_party_peers (method)">#update_third_party_peers</a></span></p>
|
371
|
-
|
372
|
-
<div id="constructor_details" class="method_details_list">
|
373
|
-
<h2>Constructor Details</h2>
|
374
|
-
|
375
|
-
<div class="method_details first">
|
376
|
-
<h3 class="signature first" id="initialize-instance_method">
|
377
|
-
|
378
|
-
#<strong>initialize</strong>(key) ⇒ <tt><span class='object_link'><a href="" title="DashboardAPI (class)">DashboardAPI</a></span></tt>
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
</h3><div class="docstring">
|
385
|
-
<div class="discussion">
|
386
|
-
|
387
|
-
<p>Returns a new instance of DashboardAPI</p>
|
388
|
-
|
389
|
-
|
390
|
-
</div>
|
391
|
-
</div>
|
392
|
-
<div class="tags">
|
393
|
-
|
394
|
-
|
395
|
-
</div><table class="source_code">
|
396
|
-
<tr>
|
397
|
-
<td>
|
398
|
-
<pre class="lines">
|
399
|
-
|
400
|
-
|
401
|
-
36
|
402
|
-
37
|
403
|
-
38</pre>
|
404
|
-
</td>
|
405
|
-
<td>
|
406
|
-
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 36</span>
|
407
|
-
|
408
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
409
|
-
<span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
410
|
-
<span class='kw'>end</span></pre>
|
411
|
-
</td>
|
412
|
-
</tr>
|
413
|
-
</table>
|
414
|
-
</div>
|
415
|
-
|
416
|
-
</div>
|
417
|
-
|
418
|
-
<div id="instance_attr_details" class="attr_details">
|
419
|
-
<h2>Instance Attribute Details</h2>
|
420
|
-
|
421
|
-
|
422
|
-
<span id=""></span>
|
423
|
-
<div class="method_details first">
|
424
|
-
<h3 class="signature first" id="key-instance_method">
|
425
|
-
|
426
|
-
#<strong>key</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
</h3><div class="docstring">
|
433
|
-
<div class="discussion">
|
434
|
-
|
435
|
-
<p>Returns the value of attribute key</p>
|
436
|
-
|
437
|
-
|
438
|
-
</div>
|
439
|
-
</div>
|
440
|
-
<div class="tags">
|
441
|
-
|
442
|
-
|
443
|
-
</div><table class="source_code">
|
444
|
-
<tr>
|
445
|
-
<td>
|
446
|
-
<pre class="lines">
|
447
|
-
|
448
|
-
|
449
|
-
34
|
450
|
-
35
|
451
|
-
36</pre>
|
452
|
-
</td>
|
453
|
-
<td>
|
454
|
-
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 34</span>
|
455
|
-
|
456
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
|
457
|
-
<span class='ivar'>@key</span>
|
458
|
-
<span class='kw'>end</span></pre>
|
459
|
-
</td>
|
460
|
-
</tr>
|
461
|
-
</table>
|
462
|
-
</div>
|
463
|
-
|
464
|
-
</div>
|
465
|
-
|
466
|
-
|
467
|
-
<div id="instance_method_details" class="method_details_list">
|
468
|
-
<h2>Instance Method Details</h2>
|
469
|
-
|
470
|
-
|
471
|
-
<div class="method_details first">
|
472
|
-
<h3 class="signature first" id="make_api_call-instance_method">
|
473
|
-
|
474
|
-
#<strong>make_api_call</strong>(endpoint_url, http_method, options_hash = {}) ⇒ <tt>Object</tt>
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
</h3><div class="docstring">
|
481
|
-
<div class="discussion">
|
482
|
-
|
483
|
-
<div class="note todo">
|
484
|
-
<strong>TODO:</strong>
|
485
|
-
<div class='inline'>
|
486
|
-
<p>Eventually this will need to support POST, PUT and DELETE. It also needs to
|
487
|
-
be a bit more resillient, instead of relying on HTTParty for exception
|
488
|
-
handling</p>
|
489
|
-
</div>
|
490
|
-
</div>
|
491
|
-
|
492
|
-
|
493
|
-
<p>Inner function, not to be called directly</p>
|
494
|
-
|
495
|
-
|
496
|
-
</div>
|
497
|
-
</div>
|
498
|
-
<div class="tags">
|
499
|
-
|
500
|
-
|
501
|
-
</div><table class="source_code">
|
502
|
-
<tr>
|
503
|
-
<td>
|
504
|
-
<pre class="lines">
|
505
|
-
|
506
|
-
|
507
|
-
45
|
508
|
-
46
|
509
|
-
47
|
510
|
-
48
|
511
|
-
49
|
512
|
-
50
|
513
|
-
51
|
514
|
-
52
|
515
|
-
53
|
516
|
-
54
|
517
|
-
55
|
518
|
-
56
|
519
|
-
57
|
520
|
-
58
|
521
|
-
59
|
522
|
-
60
|
523
|
-
61
|
524
|
-
62
|
525
|
-
63
|
526
|
-
64
|
527
|
-
65
|
528
|
-
66
|
529
|
-
67
|
530
|
-
68
|
531
|
-
69
|
532
|
-
70
|
533
|
-
71
|
534
|
-
72
|
535
|
-
73
|
536
|
-
74
|
537
|
-
75
|
538
|
-
76
|
539
|
-
77
|
540
|
-
78
|
541
|
-
79
|
542
|
-
80
|
543
|
-
81
|
544
|
-
82</pre>
|
545
|
-
</td>
|
546
|
-
<td>
|
547
|
-
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 45</span>
|
548
|
-
|
549
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_make_api_call'>make_api_call</span><span class='lparen'>(</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='comma'>,</span> <span class='id identifier rubyid_http_method'>http_method</span><span class='comma'>,</span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
550
|
-
<span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>X-Cisco-Meraki-API-Key</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='ivar'>@key</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
|
551
|
-
<span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span>
|
552
|
-
|
553
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:headers</span> <span class='op'>=></span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='symbol'>:body</span> <span class='op'>=></span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:body</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rbrace'>}</span>
|
554
|
-
<span class='kw'>case</span> <span class='id identifier rubyid_http_method'>http_method</span>
|
555
|
-
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>GET</span><span class='tstring_end'>'</span></span>
|
556
|
-
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
557
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
558
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
559
|
-
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
560
|
-
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>POST</span><span class='tstring_end'>'</span></span>
|
561
|
-
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
562
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
563
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
564
|
-
<span class='kw'>begin</span>
|
565
|
-
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
566
|
-
<span class='kw'>rescue</span> <span class='const'>JSON</span><span class='op'>::</span><span class='const'>ParserError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
567
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
|
568
|
-
<span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
569
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
|
570
|
-
<span class='kw'>end</span>
|
571
|
-
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>PUT</span><span class='tstring_end'>'</span></span>
|
572
|
-
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
573
|
-
<span class='comment'># needs to check for is an array, because when you update a 3rd party VPN peer, it returns as an array
|
574
|
-
</span> <span class='comment'># if you screw something up, it returns as a Hash, and will hit the normal if res['errors'
|
575
|
-
</span> <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
576
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
577
|
-
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
578
|
-
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DELETE</span><span class='tstring_end'>'</span></span>
|
579
|
-
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
580
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
581
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
582
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span>
|
583
|
-
<span class='kw'>else</span>
|
584
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid HTTP Method. Only GET, POST, PUT and DELETE are supported.</span><span class='tstring_end'>'</span></span>
|
585
|
-
<span class='kw'>end</span>
|
586
|
-
<span class='kw'>end</span></pre>
|
587
|
-
</td>
|
588
|
-
</tr>
|
589
|
-
</table>
|
590
|
-
</div>
|
591
|
-
|
592
|
-
</div>
|
593
|
-
|
594
|
-
</div>
|
595
|
-
|
596
|
-
<div id="footer">
|
597
|
-
Generated on Thu Nov 17 22:15:39 2016 by
|
598
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
599
|
-
0.9.5 (ruby-2.3.0).
|
600
|
-
</div>
|
601
|
-
|
602
|
-
</div>
|
603
|
-
</body>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: DashboardAPI
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "DashboardAPI";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (D)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">DashboardAPI</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame" src="class_list.html"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><h1>Class: DashboardAPI
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
<dl>
|
72
|
+
<dt>Inherits:</dt>
|
73
|
+
<dd>
|
74
|
+
<span class="inheritName">Object</span>
|
75
|
+
|
76
|
+
<ul class="fullTree">
|
77
|
+
<li>Object</li>
|
78
|
+
|
79
|
+
<li class="next">DashboardAPI</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<dl>
|
93
|
+
<dt>Includes:</dt>
|
94
|
+
<dd><span class='object_link'><a href="Admins.html" title="Admins (module)">Admins</a></span>, <span class='object_link'><a href="Clients.html" title="Clients (module)">Clients</a></span>, <span class='object_link'><a href="DashboardAPIVersion.html" title="DashboardAPIVersion (module)">DashboardAPIVersion</a></span>, <span class='object_link'><a href="Devices.html" title="Devices (module)">Devices</a></span>, HTTParty, <span class='object_link'><a href="Networks.html" title="Networks (module)">Networks</a></span>, <span class='object_link'><a href="Organizations.html" title="Organizations (module)">Organizations</a></span>, <span class='object_link'><a href="Phones.html" title="Phones (module)">Phones</a></span>, <span class='object_link'><a href="SAML.html" title="SAML (module)">SAML</a></span>, <span class='object_link'><a href="SSIDs.html" title="SSIDs (module)">SSIDs</a></span>, <span class='object_link'><a href="Switchports.html" title="Switchports (module)">Switchports</a></span>, <span class='object_link'><a href="Templates.html" title="Templates (module)">Templates</a></span>, <span class='object_link'><a href="VLANs.html" title="VLANs (module)">VLANs</a></span></dd>
|
95
|
+
</dl>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dl>
|
103
|
+
<dt>Defined in:</dt>
|
104
|
+
<dd>lib/dashboard-api.rb</dd>
|
105
|
+
</dl>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<h2>Overview</h2><div class="docstring">
|
110
|
+
<div class="discussion">
|
111
|
+
|
112
|
+
<p>Ruby Implementation of the Meraki Dashboard api</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
<p class="tag_title">Author:</p>
|
120
|
+
<ul class="author">
|
121
|
+
|
122
|
+
<li>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<div class='inline'>
|
129
|
+
<p>Joe Letizia</p>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
</ul>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
<h2>Constant Summary</h2>
|
140
|
+
|
141
|
+
<h3 class="inherited">Constants included
|
142
|
+
from <span class='object_link'><a href="DashboardAPIVersion.html" title="DashboardAPIVersion (module)">DashboardAPIVersion</a></span></h3>
|
143
|
+
<p class="inherited"><span class='object_link'><a href="DashboardAPIVersion.html#VERSION-constant" title="DashboardAPIVersion::VERSION (constant)">DashboardAPIVersion::VERSION</a></span></p>
|
144
|
+
|
145
|
+
|
146
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
147
|
+
<ul class="summary">
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="note title readonly">readonly</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Returns the value of attribute key.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
</ul>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<h2>
|
185
|
+
Instance Method Summary
|
186
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
187
|
+
</h2>
|
188
|
+
|
189
|
+
<ul class="summary">
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(key) ⇒ DashboardAPI </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
<span class="note title constructor">constructor</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<span class="summary_desc"><div class='inline'>
|
211
|
+
<p>A new instance of DashboardAPI.</p>
|
212
|
+
</div></span>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
<li class="public ">
|
218
|
+
<span class="summary_signature">
|
219
|
+
|
220
|
+
<a href="#make_api_call-instance_method" title="#make_api_call (instance method)">#<strong>make_api_call</strong>(endpoint_url, http_method, options_hash = {}) ⇒ Object </a>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</span>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
<span class="summary_desc"><div class='inline'>
|
235
|
+
<p>Inner function, not to be called directly.</p>
|
236
|
+
</div></span>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
</ul>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="SAML.html" title="SAML (module)">SAML</a></span></h3>
|
254
|
+
<p class="inherited"><span class='object_link'><a href="SAML.html#create_saml_role-instance_method" title="SAML#create_saml_role (method)">#create_saml_role</a></span>, <span class='object_link'><a href="SAML.html#list_saml_roles-instance_method" title="SAML#list_saml_roles (method)">#list_saml_roles</a></span>, <span class='object_link'><a href="SAML.html#remove_saml_role-instance_method" title="SAML#remove_saml_role (method)">#remove_saml_role</a></span>, <span class='object_link'><a href="SAML.html#return_saml_role-instance_method" title="SAML#return_saml_role (method)">#return_saml_role</a></span>, <span class='object_link'><a href="SAML.html#update_saml_role-instance_method" title="SAML#update_saml_role (method)">#update_saml_role</a></span></p>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Templates.html" title="Templates (module)">Templates</a></span></h3>
|
265
|
+
<p class="inherited"><span class='object_link'><a href="Templates.html#list_templates-instance_method" title="Templates#list_templates (method)">#list_templates</a></span>, <span class='object_link'><a href="Templates.html#remove_template-instance_method" title="Templates#remove_template (method)">#remove_template</a></span></p>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Phones.html" title="Phones (module)">Phones</a></span></h3>
|
276
|
+
<p class="inherited"><span class='object_link'><a href="Phones.html#add_phone_contact-instance_method" title="Phones#add_phone_contact (method)">#add_phone_contact</a></span>, <span class='object_link'><a href="Phones.html#delete_phone_contact-instance_method" title="Phones#delete_phone_contact (method)">#delete_phone_contact</a></span>, <span class='object_link'><a href="Phones.html#list_phone_contacts-instance_method" title="Phones#list_phone_contacts (method)">#list_phone_contacts</a></span>, <span class='object_link'><a href="Phones.html#update_phone_contact-instance_method" title="Phones#update_phone_contact (method)">#update_phone_contact</a></span></p>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="VLANs.html" title="VLANs (module)">VLANs</a></span></h3>
|
287
|
+
<p class="inherited"><span class='object_link'><a href="VLANs.html#add_vlan-instance_method" title="VLANs#add_vlan (method)">#add_vlan</a></span>, <span class='object_link'><a href="VLANs.html#delete_vlan-instance_method" title="VLANs#delete_vlan (method)">#delete_vlan</a></span>, <span class='object_link'><a href="VLANs.html#list_vlans-instance_method" title="VLANs#list_vlans (method)">#list_vlans</a></span>, <span class='object_link'><a href="VLANs.html#return_vlan-instance_method" title="VLANs#return_vlan (method)">#return_vlan</a></span>, <span class='object_link'><a href="VLANs.html#update_vlan-instance_method" title="VLANs#update_vlan (method)">#update_vlan</a></span></p>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Switchports.html" title="Switchports (module)">Switchports</a></span></h3>
|
298
|
+
<p class="inherited"><span class='object_link'><a href="Switchports.html#get_single_switch_port-instance_method" title="Switchports#get_single_switch_port (method)">#get_single_switch_port</a></span>, <span class='object_link'><a href="Switchports.html#get_switch_ports-instance_method" title="Switchports#get_switch_ports (method)">#get_switch_ports</a></span>, <span class='object_link'><a href="Switchports.html#update_switchport-instance_method" title="Switchports#update_switchport (method)">#update_switchport</a></span></p>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Admins.html" title="Admins (module)">Admins</a></span></h3>
|
309
|
+
<p class="inherited"><span class='object_link'><a href="Admins.html#add_admin-instance_method" title="Admins#add_admin (method)">#add_admin</a></span>, <span class='object_link'><a href="Admins.html#list_admins-instance_method" title="Admins#list_admins (method)">#list_admins</a></span>, <span class='object_link'><a href="Admins.html#revoke_admin-instance_method" title="Admins#revoke_admin (method)">#revoke_admin</a></span>, <span class='object_link'><a href="Admins.html#update_admin-instance_method" title="Admins#update_admin (method)">#update_admin</a></span></p>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="SSIDs.html" title="SSIDs (module)">SSIDs</a></span></h3>
|
320
|
+
<p class="inherited"><span class='object_link'><a href="SSIDs.html#get_single_ssid-instance_method" title="SSIDs#get_single_ssid (method)">#get_single_ssid</a></span>, <span class='object_link'><a href="SSIDs.html#list_ssids_in_network-instance_method" title="SSIDs#list_ssids_in_network (method)">#list_ssids_in_network</a></span>, <span class='object_link'><a href="SSIDs.html#update_single_ssid-instance_method" title="SSIDs#update_single_ssid (method)">#update_single_ssid</a></span></p>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Devices.html" title="Devices (module)">Devices</a></span></h3>
|
331
|
+
<p class="inherited"><span class='object_link'><a href="Devices.html#claim_device_into_network-instance_method" title="Devices#claim_device_into_network (method)">#claim_device_into_network</a></span>, <span class='object_link'><a href="Devices.html#get_device_uplink_stats-instance_method" title="Devices#get_device_uplink_stats (method)">#get_device_uplink_stats</a></span>, <span class='object_link'><a href="Devices.html#get_single_device-instance_method" title="Devices#get_single_device (method)">#get_single_device</a></span>, <span class='object_link'><a href="Devices.html#list_devices_in_network-instance_method" title="Devices#list_devices_in_network (method)">#list_devices_in_network</a></span>, <span class='object_link'><a href="Devices.html#remove_device_from_network-instance_method" title="Devices#remove_device_from_network (method)">#remove_device_from_network</a></span>, <span class='object_link'><a href="Devices.html#update_device_attributes-instance_method" title="Devices#update_device_attributes (method)">#update_device_attributes</a></span></p>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Clients.html" title="Clients (module)">Clients</a></span></h3>
|
342
|
+
<p class="inherited"><span class='object_link'><a href="Clients.html#get_client_info_for_device-instance_method" title="Clients#get_client_info_for_device (method)">#get_client_info_for_device</a></span></p>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Networks.html" title="Networks (module)">Networks</a></span></h3>
|
353
|
+
<p class="inherited"><span class='object_link'><a href="Networks.html#bind_network_to_template-instance_method" title="Networks#bind_network_to_template (method)">#bind_network_to_template</a></span>, <span class='object_link'><a href="Networks.html#create_network-instance_method" title="Networks#create_network (method)">#create_network</a></span>, <span class='object_link'><a href="Networks.html#delete_network-instance_method" title="Networks#delete_network (method)">#delete_network</a></span>, <span class='object_link'><a href="Networks.html#get_auto_vpn_settings-instance_method" title="Networks#get_auto_vpn_settings (method)">#get_auto_vpn_settings</a></span>, <span class='object_link'><a href="Networks.html#get_ms_access_policies-instance_method" title="Networks#get_ms_access_policies (method)">#get_ms_access_policies</a></span>, <span class='object_link'><a href="Networks.html#get_networks-instance_method" title="Networks#get_networks (method)">#get_networks</a></span>, <span class='object_link'><a href="Networks.html#get_single_network-instance_method" title="Networks#get_single_network (method)">#get_single_network</a></span>, <span class='object_link'><a href="Networks.html#traffic_analysis-instance_method" title="Networks#traffic_analysis (method)">#traffic_analysis</a></span>, <span class='object_link'><a href="Networks.html#unbind_network_to_template-instance_method" title="Networks#unbind_network_to_template (method)">#unbind_network_to_template</a></span>, <span class='object_link'><a href="Networks.html#update_auto_vpn_settings-instance_method" title="Networks#update_auto_vpn_settings (method)">#update_auto_vpn_settings</a></span>, <span class='object_link'><a href="Networks.html#update_network-instance_method" title="Networks#update_network (method)">#update_network</a></span></p>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Organizations.html" title="Organizations (module)">Organizations</a></span></h3>
|
370
|
+
<p class="inherited"><span class='object_link'><a href="Organizations.html#claim-instance_method" title="Organizations#claim (method)">#claim</a></span>, <span class='object_link'><a href="Organizations.html#clone_organization-instance_method" title="Organizations#clone_organization (method)">#clone_organization</a></span>, <span class='object_link'><a href="Organizations.html#create_organization-instance_method" title="Organizations#create_organization (method)">#create_organization</a></span>, <span class='object_link'><a href="Organizations.html#get_inventory-instance_method" title="Organizations#get_inventory (method)">#get_inventory</a></span>, <span class='object_link'><a href="Organizations.html#get_license_state-instance_method" title="Organizations#get_license_state (method)">#get_license_state</a></span>, <span class='object_link'><a href="Organizations.html#get_organization-instance_method" title="Organizations#get_organization (method)">#get_organization</a></span>, <span class='object_link'><a href="Organizations.html#get_snmp_settings-instance_method" title="Organizations#get_snmp_settings (method)">#get_snmp_settings</a></span>, <span class='object_link'><a href="Organizations.html#get_third_party_peers-instance_method" title="Organizations#get_third_party_peers (method)">#get_third_party_peers</a></span>, <span class='object_link'><a href="Organizations.html#list_all_organizations-instance_method" title="Organizations#list_all_organizations (method)">#list_all_organizations</a></span>, <span class='object_link'><a href="Organizations.html#update_organization-instance_method" title="Organizations#update_organization (method)">#update_organization</a></span>, <span class='object_link'><a href="Organizations.html#update_snmp_settings-instance_method" title="Organizations#update_snmp_settings (method)">#update_snmp_settings</a></span>, <span class='object_link'><a href="Organizations.html#update_third_party_peers-instance_method" title="Organizations#update_third_party_peers (method)">#update_third_party_peers</a></span></p>
|
371
|
+
|
372
|
+
<div id="constructor_details" class="method_details_list">
|
373
|
+
<h2>Constructor Details</h2>
|
374
|
+
|
375
|
+
<div class="method_details first">
|
376
|
+
<h3 class="signature first" id="initialize-instance_method">
|
377
|
+
|
378
|
+
#<strong>initialize</strong>(key) ⇒ <tt><span class='object_link'><a href="" title="DashboardAPI (class)">DashboardAPI</a></span></tt>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
</h3><div class="docstring">
|
385
|
+
<div class="discussion">
|
386
|
+
|
387
|
+
<p>Returns a new instance of DashboardAPI</p>
|
388
|
+
|
389
|
+
|
390
|
+
</div>
|
391
|
+
</div>
|
392
|
+
<div class="tags">
|
393
|
+
|
394
|
+
|
395
|
+
</div><table class="source_code">
|
396
|
+
<tr>
|
397
|
+
<td>
|
398
|
+
<pre class="lines">
|
399
|
+
|
400
|
+
|
401
|
+
36
|
402
|
+
37
|
403
|
+
38</pre>
|
404
|
+
</td>
|
405
|
+
<td>
|
406
|
+
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 36</span>
|
407
|
+
|
408
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
409
|
+
<span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
410
|
+
<span class='kw'>end</span></pre>
|
411
|
+
</td>
|
412
|
+
</tr>
|
413
|
+
</table>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
</div>
|
417
|
+
|
418
|
+
<div id="instance_attr_details" class="attr_details">
|
419
|
+
<h2>Instance Attribute Details</h2>
|
420
|
+
|
421
|
+
|
422
|
+
<span id=""></span>
|
423
|
+
<div class="method_details first">
|
424
|
+
<h3 class="signature first" id="key-instance_method">
|
425
|
+
|
426
|
+
#<strong>key</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
</h3><div class="docstring">
|
433
|
+
<div class="discussion">
|
434
|
+
|
435
|
+
<p>Returns the value of attribute key</p>
|
436
|
+
|
437
|
+
|
438
|
+
</div>
|
439
|
+
</div>
|
440
|
+
<div class="tags">
|
441
|
+
|
442
|
+
|
443
|
+
</div><table class="source_code">
|
444
|
+
<tr>
|
445
|
+
<td>
|
446
|
+
<pre class="lines">
|
447
|
+
|
448
|
+
|
449
|
+
34
|
450
|
+
35
|
451
|
+
36</pre>
|
452
|
+
</td>
|
453
|
+
<td>
|
454
|
+
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 34</span>
|
455
|
+
|
456
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
|
457
|
+
<span class='ivar'>@key</span>
|
458
|
+
<span class='kw'>end</span></pre>
|
459
|
+
</td>
|
460
|
+
</tr>
|
461
|
+
</table>
|
462
|
+
</div>
|
463
|
+
|
464
|
+
</div>
|
465
|
+
|
466
|
+
|
467
|
+
<div id="instance_method_details" class="method_details_list">
|
468
|
+
<h2>Instance Method Details</h2>
|
469
|
+
|
470
|
+
|
471
|
+
<div class="method_details first">
|
472
|
+
<h3 class="signature first" id="make_api_call-instance_method">
|
473
|
+
|
474
|
+
#<strong>make_api_call</strong>(endpoint_url, http_method, options_hash = {}) ⇒ <tt>Object</tt>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
</h3><div class="docstring">
|
481
|
+
<div class="discussion">
|
482
|
+
|
483
|
+
<div class="note todo">
|
484
|
+
<strong>TODO:</strong>
|
485
|
+
<div class='inline'>
|
486
|
+
<p>Eventually this will need to support POST, PUT and DELETE. It also needs to
|
487
|
+
be a bit more resillient, instead of relying on HTTParty for exception
|
488
|
+
handling</p>
|
489
|
+
</div>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
|
493
|
+
<p>Inner function, not to be called directly</p>
|
494
|
+
|
495
|
+
|
496
|
+
</div>
|
497
|
+
</div>
|
498
|
+
<div class="tags">
|
499
|
+
|
500
|
+
|
501
|
+
</div><table class="source_code">
|
502
|
+
<tr>
|
503
|
+
<td>
|
504
|
+
<pre class="lines">
|
505
|
+
|
506
|
+
|
507
|
+
45
|
508
|
+
46
|
509
|
+
47
|
510
|
+
48
|
511
|
+
49
|
512
|
+
50
|
513
|
+
51
|
514
|
+
52
|
515
|
+
53
|
516
|
+
54
|
517
|
+
55
|
518
|
+
56
|
519
|
+
57
|
520
|
+
58
|
521
|
+
59
|
522
|
+
60
|
523
|
+
61
|
524
|
+
62
|
525
|
+
63
|
526
|
+
64
|
527
|
+
65
|
528
|
+
66
|
529
|
+
67
|
530
|
+
68
|
531
|
+
69
|
532
|
+
70
|
533
|
+
71
|
534
|
+
72
|
535
|
+
73
|
536
|
+
74
|
537
|
+
75
|
538
|
+
76
|
539
|
+
77
|
540
|
+
78
|
541
|
+
79
|
542
|
+
80
|
543
|
+
81
|
544
|
+
82</pre>
|
545
|
+
</td>
|
546
|
+
<td>
|
547
|
+
<pre class="code"><span class="info file"># File 'lib/dashboard-api.rb', line 45</span>
|
548
|
+
|
549
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_make_api_call'>make_api_call</span><span class='lparen'>(</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='comma'>,</span> <span class='id identifier rubyid_http_method'>http_method</span><span class='comma'>,</span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
550
|
+
<span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>X-Cisco-Meraki-API-Key</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='ivar'>@key</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
|
551
|
+
<span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span>
|
552
|
+
|
553
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:headers</span> <span class='op'>=></span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='symbol'>:body</span> <span class='op'>=></span> <span class='id identifier rubyid_options_hash'>options_hash</span><span class='lbracket'>[</span><span class='symbol'>:body</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rbrace'>}</span>
|
554
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_http_method'>http_method</span>
|
555
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>GET</span><span class='tstring_end'>'</span></span>
|
556
|
+
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
557
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
558
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
559
|
+
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
560
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>POST</span><span class='tstring_end'>'</span></span>
|
561
|
+
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
562
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
563
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
564
|
+
<span class='kw'>begin</span>
|
565
|
+
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
566
|
+
<span class='kw'>rescue</span> <span class='const'>JSON</span><span class='op'>::</span><span class='const'>ParserError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
567
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
|
568
|
+
<span class='kw'>rescue</span> <span class='const'>TypeError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
569
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
|
570
|
+
<span class='kw'>end</span>
|
571
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>PUT</span><span class='tstring_end'>'</span></span>
|
572
|
+
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
573
|
+
<span class='comment'># needs to check for is an array, because when you update a 3rd party VPN peer, it returns as an array
|
574
|
+
</span> <span class='comment'># if you screw something up, it returns as a Hash, and will hit the normal if res['errors'
|
575
|
+
</span> <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
576
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
577
|
+
<span class='kw'>return</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
578
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DELETE</span><span class='tstring_end'>'</span></span>
|
579
|
+
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='const'>HTTParty</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_endpoint_url'>endpoint_url</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
580
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Bad Request due to the following error(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
581
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>404 returned. Are you sure you are using the proper IDs?</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>404</span>
|
582
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span>
|
583
|
+
<span class='kw'>else</span>
|
584
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid HTTP Method. Only GET, POST, PUT and DELETE are supported.</span><span class='tstring_end'>'</span></span>
|
585
|
+
<span class='kw'>end</span>
|
586
|
+
<span class='kw'>end</span></pre>
|
587
|
+
</td>
|
588
|
+
</tr>
|
589
|
+
</table>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
</div>
|
593
|
+
|
594
|
+
</div>
|
595
|
+
|
596
|
+
<div id="footer">
|
597
|
+
Generated on Thu Nov 17 22:15:39 2016 by
|
598
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
599
|
+
0.9.5 (ruby-2.3.0).
|
600
|
+
</div>
|
601
|
+
|
602
|
+
</div>
|
603
|
+
</body>
|
604
604
|
</html>
|