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/lib/phones.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
# Phones section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Phones
|
4
|
-
|
5
|
-
# Get list of phone contacts
|
6
|
-
# @param [String] network_id the network id you want to list contacts for
|
7
|
-
# @return [Array] an array of hashes containing attribute information for each contact
|
8
|
-
def list_phone_contacts(network_id)
|
9
|
-
self.make_api_call("/networks/#{network_id}/phoneContacts", 'GET')
|
10
|
-
end
|
11
|
-
|
12
|
-
# Add a single phone contact
|
13
|
-
# @param [String] network_id the network id you want to add the contact to
|
14
|
-
# @param [Hash] options an options hash that contains the contact attributes. Currently only supports the name attribute.
|
15
|
-
# @return [Hash] returns the hash containing the contact attributes
|
16
|
-
def add_phone_contact(network_id, options)
|
17
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
18
|
-
|
19
|
-
self.make_api_call("/networks/#{network_id}/phoneContacts", 'POST', options)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Update a single phone contact
|
23
|
-
# @param [String] network_id the network id you want to update the contact in
|
24
|
-
# @param [String] contact_id the ID of the contact you want to update
|
25
|
-
# @param [Hash] options an options hash that contains the contact attributes. Currently only supports the name attribute.
|
26
|
-
# @return [Hash] returns the hash containing the contacts updated attributes
|
27
|
-
def update_phone_contact(network_id, contact_id, options)
|
28
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
29
|
-
|
30
|
-
self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'PUT', options)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Delete a single phone contact
|
34
|
-
# @param [String] network_id the network id you want to delete the contact on
|
35
|
-
# @param [String] contact_id the ID of the contact you want to delete
|
36
|
-
# @return [Integer] HTTP Code
|
37
|
-
def delete_phone_contact(network_id, contact_id)
|
38
|
-
self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'DELETE')
|
39
|
-
end
|
40
|
-
end
|
1
|
+
# Phones section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Phones
|
4
|
+
|
5
|
+
# Get list of phone contacts
|
6
|
+
# @param [String] network_id the network id you want to list contacts for
|
7
|
+
# @return [Array] an array of hashes containing attribute information for each contact
|
8
|
+
def list_phone_contacts(network_id)
|
9
|
+
self.make_api_call("/networks/#{network_id}/phoneContacts", 'GET')
|
10
|
+
end
|
11
|
+
|
12
|
+
# Add a single phone contact
|
13
|
+
# @param [String] network_id the network id you want to add the contact to
|
14
|
+
# @param [Hash] options an options hash that contains the contact attributes. Currently only supports the name attribute.
|
15
|
+
# @return [Hash] returns the hash containing the contact attributes
|
16
|
+
def add_phone_contact(network_id, options)
|
17
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
18
|
+
|
19
|
+
self.make_api_call("/networks/#{network_id}/phoneContacts", 'POST', options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Update a single phone contact
|
23
|
+
# @param [String] network_id the network id you want to update the contact in
|
24
|
+
# @param [String] contact_id the ID of the contact you want to update
|
25
|
+
# @param [Hash] options an options hash that contains the contact attributes. Currently only supports the name attribute.
|
26
|
+
# @return [Hash] returns the hash containing the contacts updated attributes
|
27
|
+
def update_phone_contact(network_id, contact_id, options)
|
28
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
29
|
+
|
30
|
+
self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'PUT', options)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Delete a single phone contact
|
34
|
+
# @param [String] network_id the network id you want to delete the contact on
|
35
|
+
# @param [String] contact_id the ID of the contact you want to delete
|
36
|
+
# @return [Integer] HTTP Code
|
37
|
+
def delete_phone_contact(network_id, contact_id)
|
38
|
+
self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'DELETE')
|
39
|
+
end
|
40
|
+
end
|
data/lib/saml.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
# SAML section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module SAML
|
4
|
-
# List all SAML roles defined on an organization
|
5
|
-
# @param [String] org_id organization ID you want the SAML roles from
|
6
|
-
# @return [Array] an array of hashes containing each SAML role and it's attributes
|
7
|
-
def list_saml_roles(org_id)
|
8
|
-
self.make_api_call("/organizations/#{org_id}/samlRoles", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Create a new SAML role on an organization
|
12
|
-
# @param [String] org_id organization ID you want to create the SAML roles on
|
13
|
-
# @param [Hash] options an options hash containing the attributes for the SAML role. Can include role, orgAccess, tags, and networks.
|
14
|
-
# Refer to the Meraki Dashboard API for more information on these tags
|
15
|
-
# @return [Hash] returns the newly created SAML role
|
16
|
-
def create_saml_role(org_id, options)
|
17
|
-
|
18
|
-
self.make_api_call("/organizations/#{org_id}/samlRoles", 'POST', options)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Update an existing SAML role on an organization
|
22
|
-
# @param [String] org_id organization ID you want to update the SAML roles on
|
23
|
-
# @param [String] saml_id the ID of the SAML role that you want to update
|
24
|
-
# @param [Hash] options an options hash containing the attributes for the SAML role. Can include role, orgAccess, tags, and networks.
|
25
|
-
# Refer to the Meraki Dashboard API for more information on these tags
|
26
|
-
# @return [Hahs] returns the updated SAML role
|
27
|
-
def update_saml_role(org_id, saml_id, options)
|
28
|
-
|
29
|
-
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'PUT', options)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Return a single SAML role
|
33
|
-
# @param [String] org_id organization ID you want to return the SAML roles on
|
34
|
-
# @param [String] saml_id the ID of the SAML role that you want to return
|
35
|
-
# @return [Hash] returns the request SAML role
|
36
|
-
def return_saml_role(org_id, saml_id)
|
37
|
-
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'GET')
|
38
|
-
end
|
39
|
-
|
40
|
-
# Remove a single SAML role
|
41
|
-
# @param [String] org_id organization ID you want to remove the SAML roles on
|
42
|
-
# @param [String] saml_id the ID of the SAML role that you want to remove
|
43
|
-
# @return [Integer] HTTP Code
|
44
|
-
def remove_saml_role(org_id, saml_id)
|
45
|
-
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'DELETE')
|
46
|
-
end
|
47
|
-
end
|
1
|
+
# SAML section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module SAML
|
4
|
+
# List all SAML roles defined on an organization
|
5
|
+
# @param [String] org_id organization ID you want the SAML roles from
|
6
|
+
# @return [Array] an array of hashes containing each SAML role and it's attributes
|
7
|
+
def list_saml_roles(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}/samlRoles", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Create a new SAML role on an organization
|
12
|
+
# @param [String] org_id organization ID you want to create the SAML roles on
|
13
|
+
# @param [Hash] options an options hash containing the attributes for the SAML role. Can include role, orgAccess, tags, and networks.
|
14
|
+
# Refer to the Meraki Dashboard API for more information on these tags
|
15
|
+
# @return [Hash] returns the newly created SAML role
|
16
|
+
def create_saml_role(org_id, options)
|
17
|
+
|
18
|
+
self.make_api_call("/organizations/#{org_id}/samlRoles", 'POST', options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Update an existing SAML role on an organization
|
22
|
+
# @param [String] org_id organization ID you want to update the SAML roles on
|
23
|
+
# @param [String] saml_id the ID of the SAML role that you want to update
|
24
|
+
# @param [Hash] options an options hash containing the attributes for the SAML role. Can include role, orgAccess, tags, and networks.
|
25
|
+
# Refer to the Meraki Dashboard API for more information on these tags
|
26
|
+
# @return [Hahs] returns the updated SAML role
|
27
|
+
def update_saml_role(org_id, saml_id, options)
|
28
|
+
|
29
|
+
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'PUT', options)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Return a single SAML role
|
33
|
+
# @param [String] org_id organization ID you want to return the SAML roles on
|
34
|
+
# @param [String] saml_id the ID of the SAML role that you want to return
|
35
|
+
# @return [Hash] returns the request SAML role
|
36
|
+
def return_saml_role(org_id, saml_id)
|
37
|
+
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'GET')
|
38
|
+
end
|
39
|
+
|
40
|
+
# Remove a single SAML role
|
41
|
+
# @param [String] org_id organization ID you want to remove the SAML roles on
|
42
|
+
# @param [String] saml_id the ID of the SAML role that you want to remove
|
43
|
+
# @return [Integer] HTTP Code
|
44
|
+
def remove_saml_role(org_id, saml_id)
|
45
|
+
self.make_api_call("/organizations/#{org_id}/samlRoles/#{saml_id}", 'DELETE')
|
46
|
+
end
|
47
|
+
end
|
data/lib/ssids.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
# SSIDs section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module SSIDs
|
4
|
-
# Get a list of the SSIDs and their attributes for a network
|
5
|
-
# @param [String] network_id network id where the SSIDs you exists are
|
6
|
-
# @return [Array] an array of Hashes containing the SSID attributes
|
7
|
-
def list_ssids_in_network(network_id)
|
8
|
-
self.make_api_call("/networks/#{network_id}/ssids", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Get the attributes for a single SSID
|
12
|
-
# @param [String] network_id network id where the SSID you want to list is
|
13
|
-
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
14
|
-
# @return [Hash] the attributes for the requested SSID
|
15
|
-
def get_single_ssid(network_id, ssid_number)
|
16
|
-
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
17
|
-
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'GET')
|
18
|
-
end
|
19
|
-
|
20
|
-
# Update the attributes for a single SSID
|
21
|
-
# @param [String] network_id network id where the SSID you want to change is
|
22
|
-
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
23
|
-
# @param [Hash] options hash containing the attributes to update. Can include name, enabled, authMode, encryptionMode and psk
|
24
|
-
# @return [Hash] the updated attributes for the SSID
|
25
|
-
def update_single_ssid(network_id, ssid_number, options)
|
26
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
27
|
-
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
28
|
-
|
29
|
-
|
30
|
-
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'PUT', options)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
1
|
+
# SSIDs section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module SSIDs
|
4
|
+
# Get a list of the SSIDs and their attributes for a network
|
5
|
+
# @param [String] network_id network id where the SSIDs you exists are
|
6
|
+
# @return [Array] an array of Hashes containing the SSID attributes
|
7
|
+
def list_ssids_in_network(network_id)
|
8
|
+
self.make_api_call("/networks/#{network_id}/ssids", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Get the attributes for a single SSID
|
12
|
+
# @param [String] network_id network id where the SSID you want to list is
|
13
|
+
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
14
|
+
# @return [Hash] the attributes for the requested SSID
|
15
|
+
def get_single_ssid(network_id, ssid_number)
|
16
|
+
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
17
|
+
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'GET')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update the attributes for a single SSID
|
21
|
+
# @param [String] network_id network id where the SSID you want to change is
|
22
|
+
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
23
|
+
# @param [Hash] options hash containing the attributes to update. Can include name, enabled, authMode, encryptionMode and psk
|
24
|
+
# @return [Hash] the updated attributes for the SSID
|
25
|
+
def update_single_ssid(network_id, ssid_number, options)
|
26
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
27
|
+
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
28
|
+
|
29
|
+
|
30
|
+
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'PUT', options)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/lib/switchports.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
# Switchports section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Switchports
|
4
|
-
# Get configuration for all switchports on a given switch
|
5
|
-
# @param [String] device_serial meraki serial number of the switch
|
6
|
-
# @return [Array] an array of Hashes, each containing the switchports attributes / configuration
|
7
|
-
def get_switch_ports(device_serial)
|
8
|
-
self.make_api_call("/devices/#{device_serial}/switchPorts", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Get configuration for a single switch port
|
12
|
-
# @param [String] device_serial meraki serial number of the switch
|
13
|
-
# @param [Integer] port_number port number you want to modify
|
14
|
-
# @return [Hash] hash of the switch ports attributes
|
15
|
-
def get_single_switch_port(device_serial, port_number)
|
16
|
-
raise 'Invalid switchport provided' unless port_number.is_a?(Integer)
|
17
|
-
self.make_api_call("/devices/#{device_serial}/switchPorts/#{port_number}", 'GET')
|
18
|
-
end
|
19
|
-
|
20
|
-
# Update the attributes for a given switchport
|
21
|
-
# @param [String] device_serial meraki serial number of the switch
|
22
|
-
# @param [Integer] port_number port number you want to modify
|
23
|
-
# @param [Hash] options hash of attributes. Keys can include name, tags, enabled, type, vlan, voiceVlan
|
24
|
-
# allowedVlans, poeEnabled, isolationEnabled, rstpEnabled, stpGuard, accessPolicyNumber. For values to these keys, please refer to the official Meraki Dashboard API documentation.
|
25
|
-
# @return [Hash] hash of the update port attributes
|
26
|
-
def update_switchport(device_serial, port_number, options)
|
27
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
28
|
-
raise 'Invalid switchport provided' unless port_number.is_a?(Integer)
|
29
|
-
|
30
|
-
|
31
|
-
self.make_api_call("/devices/#{device_serial}/switchPorts/#{port_number}", 'PUT', options)
|
32
|
-
end
|
33
|
-
end
|
1
|
+
# Switchports section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Switchports
|
4
|
+
# Get configuration for all switchports on a given switch
|
5
|
+
# @param [String] device_serial meraki serial number of the switch
|
6
|
+
# @return [Array] an array of Hashes, each containing the switchports attributes / configuration
|
7
|
+
def get_switch_ports(device_serial)
|
8
|
+
self.make_api_call("/devices/#{device_serial}/switchPorts", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Get configuration for a single switch port
|
12
|
+
# @param [String] device_serial meraki serial number of the switch
|
13
|
+
# @param [Integer] port_number port number you want to modify
|
14
|
+
# @return [Hash] hash of the switch ports attributes
|
15
|
+
def get_single_switch_port(device_serial, port_number)
|
16
|
+
raise 'Invalid switchport provided' unless port_number.is_a?(Integer)
|
17
|
+
self.make_api_call("/devices/#{device_serial}/switchPorts/#{port_number}", 'GET')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update the attributes for a given switchport
|
21
|
+
# @param [String] device_serial meraki serial number of the switch
|
22
|
+
# @param [Integer] port_number port number you want to modify
|
23
|
+
# @param [Hash] options hash of attributes. Keys can include name, tags, enabled, type, vlan, voiceVlan
|
24
|
+
# allowedVlans, poeEnabled, isolationEnabled, rstpEnabled, stpGuard, accessPolicyNumber. For values to these keys, please refer to the official Meraki Dashboard API documentation.
|
25
|
+
# @return [Hash] hash of the update port attributes
|
26
|
+
def update_switchport(device_serial, port_number, options)
|
27
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
28
|
+
raise 'Invalid switchport provided' unless port_number.is_a?(Integer)
|
29
|
+
|
30
|
+
|
31
|
+
self.make_api_call("/devices/#{device_serial}/switchPorts/#{port_number}", 'PUT', options)
|
32
|
+
end
|
33
|
+
end
|
data/lib/templates.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# Templates section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Templates
|
4
|
-
# Return a list of all templates for a specific organization
|
5
|
-
# @param [String] org_id organization ID where that we want to list all of the templates from
|
6
|
-
# @return [Array] an array of hashes containing the attributes for all configuration templates
|
7
|
-
def list_templates(org_id)
|
8
|
-
self.make_api_call("/organizations/#{org_id}/configTemplates", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Remove a single configuration template
|
12
|
-
# @param [String] org_id organization ID where that we want to remove the templates from
|
13
|
-
# @param [String] template_id the template ID we want to delete
|
14
|
-
# @return [Integer] HTTP code
|
15
|
-
def remove_template(org_id, template_id)
|
16
|
-
self.make_api_call("/organizations/#{org_id}/configTemplates/#{template_id}", 'DELETE')
|
17
|
-
end
|
18
|
-
end
|
1
|
+
# Templates section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Templates
|
4
|
+
# Return a list of all templates for a specific organization
|
5
|
+
# @param [String] org_id organization ID where that we want to list all of the templates from
|
6
|
+
# @return [Array] an array of hashes containing the attributes for all configuration templates
|
7
|
+
def list_templates(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}/configTemplates", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Remove a single configuration template
|
12
|
+
# @param [String] org_id organization ID where that we want to remove the templates from
|
13
|
+
# @param [String] template_id the template ID we want to delete
|
14
|
+
# @return [Integer] HTTP code
|
15
|
+
def remove_template(org_id, template_id)
|
16
|
+
self.make_api_call("/organizations/#{org_id}/configTemplates/#{template_id}", 'DELETE')
|
17
|
+
end
|
18
|
+
end
|
data/lib/vlans.rb
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
# VLANs section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module VLANs
|
4
|
-
# Returns a list of the configured VLANs in a Dashboard network
|
5
|
-
# @param [String] network_id the network ID you want the VLANs for
|
6
|
-
# @return [Array] an array of hashes containing each VLAN and it's attributes
|
7
|
-
def list_vlans(network_id)
|
8
|
-
self.make_api_call("/networks/#{network_id}/vlans", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Return a single configured VLAN for a network
|
12
|
-
# @param [String] network_id the network ID the VLAN exists in
|
13
|
-
# @param [Integer] vlan_id the VLAN ID you want the attributes for
|
14
|
-
# @return [Hash] a hash of the VLAN's attributes
|
15
|
-
def return_vlan(network_id, vlan_id)
|
16
|
-
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'GET')
|
17
|
-
end
|
18
|
-
|
19
|
-
# Add a single VLAN to a network
|
20
|
-
# @param [String] network_id the network you want to add a VLAN to
|
21
|
-
# @param [Hash] options a hash containing the attributes of id, name, subnet and applianceIp
|
22
|
-
# additional details on these can be found in the official Meraki API Documentation
|
23
|
-
# @return [Hash] the attributes of the newly created vlan
|
24
|
-
def add_vlan(network_id, options)
|
25
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
26
|
-
|
27
|
-
self.make_api_call("/networks/#{network_id}/vlans", 'POST', options)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Update the attributes for a single VLAN
|
31
|
-
# @param [String] network_id the network ID for the VLAN you want to update
|
32
|
-
# @param [Integer] vlan_id the VLAN ID you want to update
|
33
|
-
# @param [Hash] options a hash containing the attributes of name, subnet and applianceIp.
|
34
|
-
# additional details on these can be found in the official Meraki API Documentation
|
35
|
-
# @return [Hash] the updated attributes for the VLAN
|
36
|
-
def update_vlan(network_id, vlan_id, options)
|
37
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
38
|
-
|
39
|
-
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'PUT', options)
|
40
|
-
end
|
41
|
-
|
42
|
-
# Delete a single vlan
|
43
|
-
# @param [String] network_id the Network ID for the VLAN you want to delete
|
44
|
-
# @param [Integer] vlan_id the VLAN ID you want to delete
|
45
|
-
# @return [Integer] code HTTP return code
|
46
|
-
def delete_vlan(network_id, vlan_id)
|
47
|
-
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'DELETE')
|
48
|
-
end
|
49
|
-
end
|
1
|
+
# VLANs section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module VLANs
|
4
|
+
# Returns a list of the configured VLANs in a Dashboard network
|
5
|
+
# @param [String] network_id the network ID you want the VLANs for
|
6
|
+
# @return [Array] an array of hashes containing each VLAN and it's attributes
|
7
|
+
def list_vlans(network_id)
|
8
|
+
self.make_api_call("/networks/#{network_id}/vlans", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Return a single configured VLAN for a network
|
12
|
+
# @param [String] network_id the network ID the VLAN exists in
|
13
|
+
# @param [Integer] vlan_id the VLAN ID you want the attributes for
|
14
|
+
# @return [Hash] a hash of the VLAN's attributes
|
15
|
+
def return_vlan(network_id, vlan_id)
|
16
|
+
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'GET')
|
17
|
+
end
|
18
|
+
|
19
|
+
# Add a single VLAN to a network
|
20
|
+
# @param [String] network_id the network you want to add a VLAN to
|
21
|
+
# @param [Hash] options a hash containing the attributes of id, name, subnet and applianceIp
|
22
|
+
# additional details on these can be found in the official Meraki API Documentation
|
23
|
+
# @return [Hash] the attributes of the newly created vlan
|
24
|
+
def add_vlan(network_id, options)
|
25
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
26
|
+
|
27
|
+
self.make_api_call("/networks/#{network_id}/vlans", 'POST', options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Update the attributes for a single VLAN
|
31
|
+
# @param [String] network_id the network ID for the VLAN you want to update
|
32
|
+
# @param [Integer] vlan_id the VLAN ID you want to update
|
33
|
+
# @param [Hash] options a hash containing the attributes of name, subnet and applianceIp.
|
34
|
+
# additional details on these can be found in the official Meraki API Documentation
|
35
|
+
# @return [Hash] the updated attributes for the VLAN
|
36
|
+
def update_vlan(network_id, vlan_id, options)
|
37
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
38
|
+
|
39
|
+
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'PUT', options)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Delete a single vlan
|
43
|
+
# @param [String] network_id the Network ID for the VLAN you want to delete
|
44
|
+
# @param [Integer] vlan_id the VLAN ID you want to delete
|
45
|
+
# @return [Integer] code HTTP return code
|
46
|
+
def delete_vlan(network_id, vlan_id)
|
47
|
+
self.make_api_call("/networks/#{network_id}/vlans/#{vlan_id}", 'DELETE')
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dashboard-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Letizia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.9.
|
47
|
+
version: 0.9.11
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.9.
|
54
|
+
version: 0.9.11
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vcr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,7 +102,9 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".codeclimate.yml"
|
105
106
|
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
106
108
|
- Gemfile
|
107
109
|
- Gemfile.lock
|
108
110
|
- README.md
|
@@ -167,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
169
|
version: '0'
|
168
170
|
requirements: []
|
169
171
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.5.
|
172
|
+
rubygems_version: 2.4.5.2
|
171
173
|
signing_key:
|
172
174
|
specification_version: 4
|
173
175
|
summary: A Ruby implementation of the Meraki Dashboard API
|