dashboard-api 0.9.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,6 +77,14 @@
77
77
 
78
78
 
79
79
  <li class="odd ">
80
+ <div class="item">
81
+ <span class='object_link'><a href="Organizations.html#claim-instance_method" title="Organizations#claim (method)">#claim</a></span>
82
+ <small>Organizations</small>
83
+ </div>
84
+ </li>
85
+
86
+
87
+ <li class="even ">
80
88
  <div class="item">
81
89
  <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>
82
90
  <small>Devices</small>
@@ -84,6 +92,14 @@
84
92
  </li>
85
93
 
86
94
 
95
+ <li class="odd ">
96
+ <div class="item">
97
+ <span class='object_link'><a href="Organizations.html#clone_organization-instance_method" title="Organizations#clone_organization (method)">#clone_organization</a></span>
98
+ <small>Organizations</small>
99
+ </div>
100
+ </li>
101
+
102
+
87
103
  <li class="even ">
88
104
  <div class="item">
89
105
  <span class='object_link'><a href="Networks.html#create_network-instance_method" title="Networks#create_network (method)">#create_network</a></span>
@@ -93,6 +109,14 @@
93
109
 
94
110
 
95
111
  <li class="odd ">
112
+ <div class="item">
113
+ <span class='object_link'><a href="Organizations.html#create_organization-instance_method" title="Organizations#create_organization (method)">#create_organization</a></span>
114
+ <small>Organizations</small>
115
+ </div>
116
+ </li>
117
+
118
+
119
+ <li class="even ">
96
120
  <div class="item">
97
121
  <span class='object_link'><a href="SAML.html#create_saml_role-instance_method" title="SAML#create_saml_role (method)">#create_saml_role</a></span>
98
122
  <small>SAML</small>
@@ -100,7 +124,7 @@
100
124
  </li>
101
125
 
102
126
 
103
- <li class="even ">
127
+ <li class="odd ">
104
128
  <div class="item">
105
129
  <span class='object_link'><a href="Networks.html#delete_network-instance_method" title="Networks#delete_network (method)">#delete_network</a></span>
106
130
  <small>Networks</small>
@@ -108,7 +132,7 @@
108
132
  </li>
109
133
 
110
134
 
111
- <li class="odd ">
135
+ <li class="even ">
112
136
  <div class="item">
113
137
  <span class='object_link'><a href="Phones.html#delete_phone_contact-instance_method" title="Phones#delete_phone_contact (method)">#delete_phone_contact</a></span>
114
138
  <small>Phones</small>
@@ -116,7 +140,7 @@
116
140
  </li>
117
141
 
118
142
 
119
- <li class="even ">
143
+ <li class="odd ">
120
144
  <div class="item">
121
145
  <span class='object_link'><a href="VLANs.html#delete_vlan-instance_method" title="VLANs#delete_vlan (method)">#delete_vlan</a></span>
122
146
  <small>VLANs</small>
@@ -124,7 +148,7 @@
124
148
  </li>
125
149
 
126
150
 
127
- <li class="odd ">
151
+ <li class="even ">
128
152
  <div class="item">
129
153
  <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>
130
154
  <small>Networks</small>
@@ -132,7 +156,7 @@
132
156
  </li>
133
157
 
134
158
 
135
- <li class="even ">
159
+ <li class="odd ">
136
160
  <div class="item">
137
161
  <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>
138
162
  <small>Clients</small>
@@ -140,7 +164,7 @@
140
164
  </li>
141
165
 
142
166
 
143
- <li class="odd ">
167
+ <li class="even ">
144
168
  <div class="item">
145
169
  <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>
146
170
  <small>Devices</small>
@@ -148,7 +172,7 @@
148
172
  </li>
149
173
 
150
174
 
151
- <li class="even ">
175
+ <li class="odd ">
152
176
  <div class="item">
153
177
  <span class='object_link'><a href="Organizations.html#get_inventory-instance_method" title="Organizations#get_inventory (method)">#get_inventory</a></span>
154
178
  <small>Organizations</small>
@@ -156,7 +180,7 @@
156
180
  </li>
157
181
 
158
182
 
159
- <li class="odd ">
183
+ <li class="even ">
160
184
  <div class="item">
161
185
  <span class='object_link'><a href="Organizations.html#get_license_state-instance_method" title="Organizations#get_license_state (method)">#get_license_state</a></span>
162
186
  <small>Organizations</small>
@@ -164,7 +188,7 @@
164
188
  </li>
165
189
 
166
190
 
167
- <li class="even ">
191
+ <li class="odd ">
168
192
  <div class="item">
169
193
  <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>
170
194
  <small>Networks</small>
@@ -172,7 +196,7 @@
172
196
  </li>
173
197
 
174
198
 
175
- <li class="odd ">
199
+ <li class="even ">
176
200
  <div class="item">
177
201
  <span class='object_link'><a href="Networks.html#get_networks-instance_method" title="Networks#get_networks (method)">#get_networks</a></span>
178
202
  <small>Networks</small>
@@ -180,7 +204,7 @@
180
204
  </li>
181
205
 
182
206
 
183
- <li class="even ">
207
+ <li class="odd ">
184
208
  <div class="item">
185
209
  <span class='object_link'><a href="Organizations.html#get_organization-instance_method" title="Organizations#get_organization (method)">#get_organization</a></span>
186
210
  <small>Organizations</small>
@@ -188,7 +212,7 @@
188
212
  </li>
189
213
 
190
214
 
191
- <li class="odd ">
215
+ <li class="even ">
192
216
  <div class="item">
193
217
  <span class='object_link'><a href="Devices.html#get_single_device-instance_method" title="Devices#get_single_device (method)">#get_single_device</a></span>
194
218
  <small>Devices</small>
@@ -196,7 +220,7 @@
196
220
  </li>
197
221
 
198
222
 
199
- <li class="even ">
223
+ <li class="odd ">
200
224
  <div class="item">
201
225
  <span class='object_link'><a href="Networks.html#get_single_network-instance_method" title="Networks#get_single_network (method)">#get_single_network</a></span>
202
226
  <small>Networks</small>
@@ -204,7 +228,7 @@
204
228
  </li>
205
229
 
206
230
 
207
- <li class="odd ">
231
+ <li class="even ">
208
232
  <div class="item">
209
233
  <span class='object_link'><a href="SSIDs.html#get_single_ssid-instance_method" title="SSIDs#get_single_ssid (method)">#get_single_ssid</a></span>
210
234
  <small>SSIDs</small>
@@ -212,7 +236,7 @@
212
236
  </li>
213
237
 
214
238
 
215
- <li class="even ">
239
+ <li class="odd ">
216
240
  <div class="item">
217
241
  <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>
218
242
  <small>Switchports</small>
@@ -220,15 +244,15 @@
220
244
  </li>
221
245
 
222
246
 
223
- <li class="odd ">
247
+ <li class="even ">
224
248
  <div class="item">
225
- <span class='object_link'><a href="Organizations.html#get_snmp_status-instance_method" title="Organizations#get_snmp_status (method)">#get_snmp_status</a></span>
249
+ <span class='object_link'><a href="Organizations.html#get_snmp_settings-instance_method" title="Organizations#get_snmp_settings (method)">#get_snmp_settings</a></span>
226
250
  <small>Organizations</small>
227
251
  </div>
228
252
  </li>
229
253
 
230
254
 
231
- <li class="even ">
255
+ <li class="odd ">
232
256
  <div class="item">
233
257
  <span class='object_link'><a href="Switchports.html#get_switch_ports-instance_method" title="Switchports#get_switch_ports (method)">#get_switch_ports</a></span>
234
258
  <small>Switchports</small>
@@ -236,7 +260,7 @@
236
260
  </li>
237
261
 
238
262
 
239
- <li class="odd ">
263
+ <li class="even ">
240
264
  <div class="item">
241
265
  <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>
242
266
  <small>Organizations</small>
@@ -244,7 +268,7 @@
244
268
  </li>
245
269
 
246
270
 
247
- <li class="even ">
271
+ <li class="odd ">
248
272
  <div class="item">
249
273
  <span class='object_link'><a href="DashboardAPI.html#initialize-instance_method" title="DashboardAPI#initialize (method)">#initialize</a></span>
250
274
  <small>DashboardAPI</small>
@@ -252,7 +276,7 @@
252
276
  </li>
253
277
 
254
278
 
255
- <li class="odd ">
279
+ <li class="even ">
256
280
  <div class="item">
257
281
  <span class='object_link'><a href="DashboardAPI.html#key-instance_method" title="DashboardAPI#key (method)">#key</a></span>
258
282
  <small>DashboardAPI</small>
@@ -260,7 +284,7 @@
260
284
  </li>
261
285
 
262
286
 
263
- <li class="even ">
287
+ <li class="odd ">
264
288
  <div class="item">
265
289
  <span class='object_link'><a href="Admins.html#list_admins-instance_method" title="Admins#list_admins (method)">#list_admins</a></span>
266
290
  <small>Admins</small>
@@ -268,6 +292,14 @@
268
292
  </li>
269
293
 
270
294
 
295
+ <li class="even ">
296
+ <div class="item">
297
+ <span class='object_link'><a href="Organizations.html#list_all_organizations-instance_method" title="Organizations#list_all_organizations (method)">#list_all_organizations</a></span>
298
+ <small>Organizations</small>
299
+ </div>
300
+ </li>
301
+
302
+
271
303
  <li class="odd ">
272
304
  <div class="item">
273
305
  <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>
@@ -421,6 +453,14 @@
421
453
 
422
454
 
423
455
  <li class="even ">
456
+ <div class="item">
457
+ <span class='object_link'><a href="Organizations.html#update_organization-instance_method" title="Organizations#update_organization (method)">#update_organization</a></span>
458
+ <small>Organizations</small>
459
+ </div>
460
+ </li>
461
+
462
+
463
+ <li class="odd ">
424
464
  <div class="item">
425
465
  <span class='object_link'><a href="Phones.html#update_phone_contact-instance_method" title="Phones#update_phone_contact (method)">#update_phone_contact</a></span>
426
466
  <small>Phones</small>
@@ -428,7 +468,7 @@
428
468
  </li>
429
469
 
430
470
 
431
- <li class="odd ">
471
+ <li class="even ">
432
472
  <div class="item">
433
473
  <span class='object_link'><a href="SAML.html#update_saml_role-instance_method" title="SAML#update_saml_role (method)">#update_saml_role</a></span>
434
474
  <small>SAML</small>
@@ -436,7 +476,7 @@
436
476
  </li>
437
477
 
438
478
 
439
- <li class="even ">
479
+ <li class="odd ">
440
480
  <div class="item">
441
481
  <span class='object_link'><a href="SSIDs.html#update_single_ssid-instance_method" title="SSIDs#update_single_ssid (method)">#update_single_ssid</a></span>
442
482
  <small>SSIDs</small>
@@ -444,6 +484,14 @@
444
484
  </li>
445
485
 
446
486
 
487
+ <li class="even ">
488
+ <div class="item">
489
+ <span class='object_link'><a href="Organizations.html#update_snmp_settings-instance_method" title="Organizations#update_snmp_settings (method)">#update_snmp_settings</a></span>
490
+ <small>Organizations</small>
491
+ </div>
492
+ </li>
493
+
494
+
447
495
  <li class="odd ">
448
496
  <div class="item">
449
497
  <span class='object_link'><a href="Switchports.html#update_switchport-instance_method" title="Switchports#update_switchport (method)">#update_switchport</a></span>
@@ -453,6 +501,14 @@
453
501
 
454
502
 
455
503
  <li class="even ">
504
+ <div class="item">
505
+ <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>
506
+ <small>Organizations</small>
507
+ </div>
508
+ </li>
509
+
510
+
511
+ <li class="odd ">
456
512
  <div class="item">
457
513
  <span class='object_link'><a href="VLANs.html#update_vlan-instance_method" title="VLANs#update_vlan (method)">#update_vlan</a></span>
458
514
  <small>VLANs</small>
@@ -104,7 +104,7 @@
104
104
  </div>
105
105
 
106
106
  <div id="footer">
107
- Generated on Wed Nov 16 21:55:08 2016 by
107
+ Generated on Thu Nov 17 22:15:38 2016 by
108
108
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
109
109
  0.9.5 (ruby-2.3.0).
110
110
  </div>
@@ -66,7 +66,9 @@ class DashboardAPI
66
66
  end
67
67
  when 'PUT'
68
68
  res = HTTParty.put("#{self.class.base_uri}/#{endpoint_url}", options)
69
- raise "Bad Request due to the following error(s): #{res['errors']}" if res['errors']
69
+ # needs to check for is an array, because when you update a 3rd party VPN peer, it returns as an array
70
+ # if you screw something up, it returns as a Hash, and will hit the normal if res['errors'
71
+ raise "Bad Request due to the following error(s): #{res['errors']}" if res['errors'] unless JSON.parse(res.body).is_a? Array
70
72
  raise "404 returned. Are you sure you are using the proper IDs?" if res.code == 404
71
73
  return JSON.parse(res.body)
72
74
  when 'DELETE'
@@ -2,5 +2,5 @@
2
2
  # @author Joe Letizia
3
3
  module DashboardAPIVersion
4
4
  # Current version number of the gem
5
- VERSION = "0.9.0"
5
+ VERSION = "1.0.0"
6
6
  end
@@ -7,7 +7,7 @@ module Networks
7
7
  def get_networks(org_id)
8
8
  self.make_api_call("/organizations/#{org_id}/networks", 'GET')
9
9
  end
10
-
10
+
11
11
  # Returns the network details for a single network
12
12
  # @param [String] network_id dashboard network ID
13
13
  # @return [Hash] a hash containing the network details of the specific network
@@ -26,7 +26,7 @@ module Networks
26
26
  options = {:body => options}
27
27
  self.make_api_call("/networks/#{network_id}",'PUT', options)
28
28
  end
29
-
29
+
30
30
  # Create a new Dashboard network
31
31
  # @param [String] org_id dashboard organization ID
32
32
  # @param [Hash] options a hash containing the following options:
@@ -39,23 +39,22 @@ module Networks
39
39
  options = {:body => options}
40
40
  self.make_api_call("/organizations/#{org_id}/networks", 'POST', options)
41
41
  end
42
-
42
+
43
43
  # Delete an existing Dashboard network
44
44
  # @param [String] network_id dashboard netwok ID to delete
45
- # @return [Bool] status true if the network was deleted, false if not
45
+ # @return [Bool] status true if the network was deleted, false if not
46
46
  def delete_network(network_id)
47
47
  res = self.make_api_call("/networks/#{network_id}", 'DELETE')
48
- puts res
49
48
  return res.code == 204 ? true : false
50
49
  end
51
-
50
+
52
51
  # Get AutoVPN settings for a specific network
53
52
  # @param [String] network_id dashboard network ID to get AutoVPN settings for
54
53
  # @return [Hash] a hash containing the AutoVPN details for the network
55
54
  def get_auto_vpn_settings(network_id)
56
55
  res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'GET')
57
56
  end
58
-
57
+
59
58
  # Update AutoVPN for a specific network
60
59
  # @param [String] network_id dashboard network ID to update AutoVPN settings for
61
60
  # @param [Hash] options options hash containing the following options:
@@ -69,7 +68,7 @@ module Networks
69
68
  options = {:body => options}
70
69
  res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'PUT', options)
71
70
  end
72
-
71
+
73
72
  # Get all MS access policies configured for a specific Dashboard network
74
73
  # @param [String] network_id dashboard network ID to get MS policies for
75
74
  # @return [Array] an array of hashes for containing the policy information
@@ -25,10 +25,23 @@ module Organizations
25
25
  # Returns the current SNMP status for an organization
26
26
  # @param [String] org_id dashboard organization ID
27
27
  # @return [Hash] a hash containing all SNMP configuration information for an organization
28
- def get_snmp_status(org_id)
28
+ def get_snmp_settings(org_id)
29
29
  self.make_api_call("/organizations/#{org_id}/snmp", 'GET')
30
30
  end
31
31
 
32
+ # Updates the current SNMP status for an organization
33
+ # @param [String] org_id dashboard organization ID
34
+ # @param [Hash] options a hash containing all updated SNMP configuration information for an organization. Please
35
+ # refer to official Dashboard API documentation for more information on these options: v2cEnabled, v3Enabled,
36
+ # v3AuthMode, v3AuthPass, v3PrivMode, v3PrivPass, peerIps
37
+ # @return [Hash] a hash containing all SNMP configuration information for an organization
38
+ def update_snmp_settings(org_id, options)
39
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
40
+
41
+ options = {:body => options}
42
+ self.make_api_call("/organizations/#{org_id}/snmp", 'PUT', options)
43
+ end
44
+
32
45
  # Returns the configurations for an organizations 3rd party VPN peers
33
46
  # @param [String] org_id dashboard organization ID
34
47
  # @return [Array] an arrry of hashes containing the configuration information
@@ -36,4 +49,67 @@ module Organizations
36
49
  def get_third_party_peers(org_id)
37
50
  self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'GET')
38
51
  end
52
+
53
+ # Updates your third party peers
54
+ # @param [String] org_id dashboard organization ID
55
+ # @params [Array] options An array of Hashes representing all configured third party peer. Takes the keys of name,
56
+ # publicIp, privateSubnets and secret
57
+ # @return [Array] returns the array of hashes for all currently configured 3rd party peers
58
+ def update_third_party_peers(org_id, options)
59
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
60
+
61
+ options = {:body => options}
62
+ self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'PUT', options)
63
+ end
64
+
65
+ # Returns all organizations a user is an administrator on
66
+ # @return [Array] an array of hashes containing the organizations and their attributes
67
+ def list_all_organizations
68
+ self.make_api_call("/organizations", 'GET')
69
+ end
70
+
71
+ # Update an organization
72
+ # @param [String] org_id the organization ID that you want to update
73
+ # @param [Hash] options an options hash containing the org ID and new name of the org
74
+ # @return [Hash] the updated attributes of the organization
75
+ def update_organization(org_id, options)
76
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
77
+
78
+ options = {:body => options}
79
+ self.make_api_call("/organizations/#{org_id}", 'PUT', options)
80
+ end
81
+
82
+ # Create a new organization
83
+ # @param [Hash] options an options hash containing the name of the new organization
84
+ # @return [Hash] the attributes of the newly created organization
85
+ def create_organization(options)
86
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
87
+
88
+ options = {:body => options}
89
+ self.make_api_call("/organizations", 'POST', options)
90
+ end
91
+
92
+ # Clone an organization
93
+ # @param [String] source_org_id the source organization that we want to clone from
94
+ # @param [Hash] options options hash containing the attributes for the new organization
95
+ # @return [Hash] the attributes of the newly cloned organization
96
+ def clone_organization(source_org_id, options)
97
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
98
+
99
+ options = {:body => options}
100
+ self.make_api_call("/organizations/#{source_org_id}/clone", 'POST', options)
101
+ end
102
+
103
+ # Claim something
104
+ # @param [String] org_id the organization that you want to claim to
105
+ # @param [Hash] options a hash containing information about what you want to claim. This can be order,
106
+ # serial, licenseKey and licenseMode. Refer to the official Dashboard API documentation for more information
107
+ # about these
108
+ # @return [Integer] HTTP Code
109
+ def claim(org_id, options)
110
+ raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
111
+
112
+ options = {:body => options}
113
+ self.make_api_call("/organizations/#{org_id}/claim", 'POST', options)
114
+ end
39
115
  end