dashboard-api 0.3.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.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +31 -0
- data/README.md +103 -0
- data/Rakefile +6 -0
- data/dashboard-api.gemspec +28 -0
- data/doc/Clients.html +250 -0
- data/doc/DashboardAPI.html +532 -0
- data/doc/DashboardAPIVersion.html +122 -0
- data/doc/Devices.html +853 -0
- data/doc/Networks.html +1049 -0
- data/doc/Organizations.html +672 -0
- data/doc/SSIDs.html +497 -0
- data/doc/_index.html +171 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +481 -0
- data/doc/file.README.html +210 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +210 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +259 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/clients.rb +10 -0
- data/lib/dashboard-api.rb +67 -0
- data/lib/dashboard-api/version.rb +3 -0
- data/lib/devices.rb +55 -0
- data/lib/networks.rb +80 -0
- data/lib/organizations.rb +39 -0
- data/lib/ssids.rb +31 -0
- metadata +162 -0
data/lib/devices.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module Devices
|
2
|
+
# List all devices in a given network
|
3
|
+
# @param [String] network_id network that you want to get devices for
|
4
|
+
# @return [Array] array of hashes containing device information for all devices in the network
|
5
|
+
def list_devices_in_network(network_id)
|
6
|
+
self.make_api_call("/networks/#{network_id}/devices", 'GET')
|
7
|
+
end
|
8
|
+
|
9
|
+
# Device information for a specified device
|
10
|
+
# @param [String] network_id the network id where the device exists
|
11
|
+
# @param [String] device_serial the meraki serial number of the device you want to get
|
12
|
+
# information for
|
13
|
+
# @return [Hash] a hash containing all of the devices attributes
|
14
|
+
def get_single_device(network_id, device_serial)
|
15
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Uplink information for a specified device
|
19
|
+
# @param [String] network_id network id where the device exists
|
20
|
+
# @param [String] device_serial meraki serial number of the device you want to check
|
21
|
+
# @return [Array] an array of hashes for each uplink and it's attributes
|
22
|
+
def get_device_uplink_stats(network_id, device_serial)
|
23
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/uplink", 'GET')
|
24
|
+
end
|
25
|
+
|
26
|
+
# Update a single devices attributes
|
27
|
+
# @param [String] network_id dashboard network id where the device exists
|
28
|
+
# @param [String] device_serial meraki serial number of the device you want to modify
|
29
|
+
# @param [Hash] options hash containing the attributes you want to modify.
|
30
|
+
# such as name, tags, longitude, latitude. A full list is found on the official Meraki API Docs
|
31
|
+
# @return [Hash] a hash containing the devices new attribute set
|
32
|
+
def update_device_attributes(network_id, device_serial, options)
|
33
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
34
|
+
options = {:body => options}
|
35
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'PUT', options)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Claim a single device into a network
|
39
|
+
# @param [String] network_id dashboard network id to claim device into
|
40
|
+
# @param [Hash] options hash containing :serial => 'meraki device SN' you want to claim
|
41
|
+
# @return [Integer] code returns the HTTP code of the API call
|
42
|
+
def claim_device_into_network(network_id, options)
|
43
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
44
|
+
options = {:body => options}
|
45
|
+
self.make_api_call("/networks/#{network_id}/devices/claim", 'POST', options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Remove a single device from a network
|
49
|
+
# @param [String] network_id dashboard network id to remove device from
|
50
|
+
# @param [String] serial meraki serial number for device to remove
|
51
|
+
# @return [Integer] http_code HTTP code for API call
|
52
|
+
def remove_device_from_network(network_id, device_serial)
|
53
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/remove", 'POST')
|
54
|
+
end
|
55
|
+
end
|
data/lib/networks.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Networks section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Networks
|
4
|
+
# Returns the list of networks for a given organization
|
5
|
+
# @param [String] org_id dashboard organization ID
|
6
|
+
# @return [Array] an array of hashes containing the network details
|
7
|
+
def get_networks(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}/networks", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the network details for a single network
|
12
|
+
# @param [String] network_id dashboard network ID
|
13
|
+
# @return [Hash] a hash containing the network details of the specific network
|
14
|
+
def get_single_network(network_id)
|
15
|
+
self.make_api_call("/networks/#{network_id}", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Updates a network's details
|
19
|
+
# @param [String] network_id dashboard network ID
|
20
|
+
# @param [Hash] options a hash containing any of the following keys:
|
21
|
+
# name: the network name
|
22
|
+
# tags: tags assigned to the network
|
23
|
+
# @return [Hash] a hash containing the updated network details
|
24
|
+
def update_network(network_id, options)
|
25
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
26
|
+
options = {:body => options}
|
27
|
+
self.make_api_call("/networks/#{network_id}",'PUT', options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a new Dashboard network
|
31
|
+
# @param [String] org_id dashboard organization ID
|
32
|
+
# @param [Hash] options a hash containing the following options:
|
33
|
+
# name: the network name (REQUIRED)
|
34
|
+
# type: the type of network (wireless, switch, appliance, or phone) (REQUIRED)
|
35
|
+
# tags: tags for the network (NOT REQUIRED)
|
36
|
+
# @return [Hash] a hash containing the new networks details
|
37
|
+
def create_network(org_id, options)
|
38
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
39
|
+
options = {:body => options}
|
40
|
+
self.make_api_call("/organizations/#{org_id}/networks", 'POST', options)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Delete an existing Dashboard network
|
44
|
+
# @param [String] network_id dashboard netwok ID to delete
|
45
|
+
# @return [Bool] status true if the network was deleted, false if not
|
46
|
+
def delete_network(network_id)
|
47
|
+
res = self.make_api_call("/networks/#{network_id}", 'DELETE')
|
48
|
+
puts res
|
49
|
+
return res.code == 204 ? true : false
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get AutoVPN settings for a specific network
|
53
|
+
# @param [String] network_id dashboard network ID to get AutoVPN settings for
|
54
|
+
# @return [Hash] a hash containing the AutoVPN details for the network
|
55
|
+
def get_auto_vpn_settings(network_id)
|
56
|
+
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'GET')
|
57
|
+
end
|
58
|
+
|
59
|
+
# Update AutoVPN for a specific network
|
60
|
+
# @param [String] network_id dashboard network ID to update AutoVPN settings for
|
61
|
+
# @param [Hash] options options hash containing the following options:
|
62
|
+
# mode: hub, spoke or none
|
63
|
+
# hubs: an array of Hashes containing the hubId and a true or false for useDefaultRoute
|
64
|
+
# subnets: an array of Hashes containing localSubnet and useVPN
|
65
|
+
# @return [Hash]
|
66
|
+
def update_auto_vpn_settings(network_id, options)
|
67
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
68
|
+
|
69
|
+
options = {:body => options}
|
70
|
+
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'PUT', options)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get all MS access policies configured for a specific Dashboard network
|
74
|
+
# @param [String] network_id dashboard network ID to get MS policies for
|
75
|
+
# @return [Array] an array of hashes for containing the policy information
|
76
|
+
def get_ms_access_policies(network_id)
|
77
|
+
res = self.make_api_call("/networks/#{network_id}/accessPolicies", 'GET')
|
78
|
+
return res
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Organization section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Organizations
|
4
|
+
# Returns information about an organization
|
5
|
+
# @param [String] org_id dashboard organization ID
|
6
|
+
# @return [Hash] results contains the org id and name of the given organization
|
7
|
+
def get_organization(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the current license state for a given organization
|
12
|
+
# @param [String] org_id dashboard organization ID
|
13
|
+
# @return [Hash] results contains the current license state information
|
14
|
+
def get_license_state(org_id)
|
15
|
+
self.make_api_call("/organizations/#{org_id}/licenseState", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the current inventory for an organization
|
19
|
+
# @param [String] org_id dashboard organization ID
|
20
|
+
# @return [Array] an array of hashes containg information on each individual device
|
21
|
+
def get_inventory(org_id)
|
22
|
+
self.make_api_call("/organizations/#{org_id}/inventory", 'GET')
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the current SNMP status for an organization
|
26
|
+
# @param [String] org_id dashboard organization ID
|
27
|
+
# @return [Hash] a hash containing all SNMP configuration information for an organization
|
28
|
+
def get_snmp_status(org_id)
|
29
|
+
self.make_api_call("/organizations/#{org_id}/snmp", 'GET')
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the configurations for an organizations 3rd party VPN peers
|
33
|
+
# @param [String] org_id dashboard organization ID
|
34
|
+
# @return [Array] an arrry of hashes containing the configuration information
|
35
|
+
# for each 3rd party VPN peer
|
36
|
+
def get_third_party_peers(org_id)
|
37
|
+
self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'GET')
|
38
|
+
end
|
39
|
+
end
|
data/lib/ssids.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module SSIDs
|
2
|
+
# Get a list of the SSIDs and their attributes for a network
|
3
|
+
# @param [String] network_id network id where the SSIDs you exists are
|
4
|
+
# @return [Array] an array of Hashes containing the SSID attributes
|
5
|
+
def list_ssids_in_network(network_id)
|
6
|
+
self.make_api_call("/networks/#{network_id}/ssids", 'GET')
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get the attributes for a single SSID
|
10
|
+
# @param [String] network_id network id where the SSID you want to list is
|
11
|
+
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
12
|
+
# @return [Hash] the attributes for the requested SSID
|
13
|
+
def get_single_ssid(network_id, ssid_number)
|
14
|
+
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
15
|
+
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Update the attributes for a single SSID
|
19
|
+
# @param [String] network_id network id where the SSID you want to change is
|
20
|
+
# @param [Integer] ssid_number the SSID number you want to change. Range is from 0-14
|
21
|
+
# @param [Hash] options hash containing the attributes to update. Can include name, enabled, authMode, encryptionMode and psk
|
22
|
+
# @return [Hash] the updated attributes for the SSID
|
23
|
+
def update_single_ssid(network_id, ssid_number, options)
|
24
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
25
|
+
raise "Please provide a valid SSID number" unless (ssid_number.is_a?(Integer) && ssid_number <= 14)
|
26
|
+
options = {:body => options}
|
27
|
+
|
28
|
+
self.make_api_call("/networks/#{network_id}/ssids/#{ssid_number}", 'PUT', options)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dashboard-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe Letizia
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.5
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: httparty
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.14.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.14.0
|
97
|
+
description: A Ruby implementation of the Meraki Dashboard API. It allows you to interact
|
98
|
+
and provision the Meraki Dashboard via their RESTful API
|
99
|
+
email:
|
100
|
+
- letiziajm@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- dashboard-api.gemspec
|
111
|
+
- doc/Clients.html
|
112
|
+
- doc/DashboardAPI.html
|
113
|
+
- doc/DashboardAPIVersion.html
|
114
|
+
- doc/Devices.html
|
115
|
+
- doc/Networks.html
|
116
|
+
- doc/Organizations.html
|
117
|
+
- doc/SSIDs.html
|
118
|
+
- doc/_index.html
|
119
|
+
- doc/class_list.html
|
120
|
+
- doc/css/common.css
|
121
|
+
- doc/css/full_list.css
|
122
|
+
- doc/css/style.css
|
123
|
+
- doc/file.README.html
|
124
|
+
- doc/file_list.html
|
125
|
+
- doc/frames.html
|
126
|
+
- doc/index.html
|
127
|
+
- doc/js/app.js
|
128
|
+
- doc/js/full_list.js
|
129
|
+
- doc/js/jquery.js
|
130
|
+
- doc/method_list.html
|
131
|
+
- doc/top-level-namespace.html
|
132
|
+
- lib/clients.rb
|
133
|
+
- lib/dashboard-api.rb
|
134
|
+
- lib/dashboard-api/version.rb
|
135
|
+
- lib/devices.rb
|
136
|
+
- lib/networks.rb
|
137
|
+
- lib/organizations.rb
|
138
|
+
- lib/ssids.rb
|
139
|
+
homepage: https://github.com/jletizia/dashboardapi
|
140
|
+
licenses: []
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.5.1
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: A Ruby implementation of the Meraki Dashboard API
|
162
|
+
test_files: []
|