dashboard-api 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,210 @@
|
|
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
|
+
File: README
|
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 = "README";
|
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="file_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</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<iframe id="search_frame" src="file_list.html"></iframe>
|
61
|
+
|
62
|
+
<div id="content"><div id='filecontents'>
|
63
|
+
<h1 id="label-Dashboard+API+v0.1.0">Dashboard API v0.1.0</h1>
|
64
|
+
|
65
|
+
<p>A ruby implementation of the <a
|
66
|
+
href="https://documentation.meraki.com/zGeneral_Administration/Other_Topics/The_Cisco_Meraki_Dashboard_API">Meraki
|
67
|
+
Dashboard API</a></p>
|
68
|
+
|
69
|
+
<p>Documentation <a href="https://">here</a></p>
|
70
|
+
|
71
|
+
<h1 id="label-Preface">Preface</h1>
|
72
|
+
|
73
|
+
<p>The following readme is broken down into two sections: * Installing /
|
74
|
+
Usage of the gem * Contributing to development of the gem</p>
|
75
|
+
|
76
|
+
<h1 id="label-Installation+and+Normal+Usage">Installation and Normal Usage</h1>
|
77
|
+
|
78
|
+
<h2 id="label-Usage">Usage</h2>
|
79
|
+
|
80
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_dashboard'>dashboard</span><span class='op'>-</span><span class='id identifier rubyid_api'>api</span>
|
81
|
+
</code></pre>
|
82
|
+
|
83
|
+
<p>Once the gem is installed, you can use it by requiring
|
84
|
+
<code>dashboard-api</code> <code> require 'dashboard-api' =>
|
85
|
+
true </code></p>
|
86
|
+
|
87
|
+
<h2 id="label-Examples">Examples</h2>
|
88
|
+
|
89
|
+
<p>It is highly recommended that you utilize environment variables when
|
90
|
+
dealing with things like API keys, tokens, etc. instead of utilizing them
|
91
|
+
directly in a script. All examples will be shown with this convention.</p>
|
92
|
+
|
93
|
+
<h3 id="label-Instantiating+a+new+instance-3A">Instantiating a new instance:</h3>
|
94
|
+
|
95
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_dapi'>dapi</span> <span class='op'>=</span> <span class='const'>DashboardAPI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dashboard_api_key</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
96
|
+
</code></pre>
|
97
|
+
|
98
|
+
<h3 id="label-Listing+details+about+a+specific+network-3A">Listing details about a specific network:</h3>
|
99
|
+
|
100
|
+
<pre class="code ruby"><code class="ruby">dapi.get_single_network(ENV['vpn_network'])
|
101
|
+
=> {"id"=>"N_<OMITTED>", "organizationId"=>"<OMITTED>", "type"=>"appliance", "name"=>"vpn_test_network", "timeZone"=>"America/Los_Angeles", "tags"=>""}
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
<p>There are many times where you need to actually pass data up to the
|
105
|
+
Dashboard API, be it for creating new networks, updating device
|
106
|
+
information, etc. In situations like these, an options hash is expected to
|
107
|
+
be passed alongside to the method call. The Dashboard-API gem documentation
|
108
|
+
mentions what is expected in the option hash for methods that require it,
|
109
|
+
but the offical <a
|
110
|
+
href="https://dashboard.meraki.com/manage/support/api_docs">Meraki
|
111
|
+
Dashboard API documentation</a> is recommended for exact details.</p>
|
112
|
+
|
113
|
+
<h3 id="label-Creating+a+new+network-3A">Creating a new network:</h3>
|
114
|
+
|
115
|
+
<pre class="code ruby"><code class="ruby">options = {:name => 'new_test_network', :type => 'wireless'}
|
116
|
+
=> {:name=>"new_test_network", :type=>"wireless"}
|
117
|
+
dapi.create_network(ENV['dashboard_org_id'], options)
|
118
|
+
=> {"id"=>"N_<OMITTED>", "organizationId"=>"<OMITTED>", "type"=>"wireless", "name"=>"new_test_network", "timeZone"=>"America/Los_Angeles", "tags"=>""}
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
<p>Not every method call will return a Hash object. Some will return an Array,
|
122
|
+
often containing a Hash in each element. Information about what is expected
|
123
|
+
to be returned can be found in the Dashboard-API Documentation, as well as
|
124
|
+
the official Meraki Dashboard API help documentation.</p>
|
125
|
+
|
126
|
+
<pre class="code ruby"><code class="ruby">dapi.get_third_party_peers(ENV['dashboard_org_id'])
|
127
|
+
=> [{"name"=>"test_api_peer", "publicIp"=>"10.0.0.1", "privateSubnets"=>["10.1.0.0/24"], "secret"=>"password", "tags"=>["all"]}, {"name"=>"second_api_peerr", "publicIp"=>"10.0.0.2", "privateSubnets"=>["10.2.0.0/24"], "secret"=>"password", "tags"=>["api_test"]}]
|
128
|
+
</code></pre>
|
129
|
+
|
130
|
+
<h1 id="label-Development">Development</h1>
|
131
|
+
|
132
|
+
<h2 id="label-Testing">Testing</h2>
|
133
|
+
|
134
|
+
<p>To install the necessary dependencies run: <code> bundle install </code> If
|
135
|
+
you do not use bundler, you can check out the gemfile, and install the
|
136
|
+
dependencies individually as necessary.</p>
|
137
|
+
|
138
|
+
<p>The Meraki Dashboard API requires both an API key, as well as certain
|
139
|
+
identifiers such as Organization, or Network IDs. If you would like to run
|
140
|
+
the full current test suite, the following ENV variables need to be set:</p>
|
141
|
+
<ul><li>
|
142
|
+
<p><code>dashboard_api_key</code> Your Meraki Dashboard API key</p>
|
143
|
+
</li><li>
|
144
|
+
<p><code>dashboard_org_id</code> The Meraki Dashboard Organization ID you will
|
145
|
+
be testing on</p>
|
146
|
+
</li><li>
|
147
|
+
<p><code>test_network_id</code> A test network ID that will be used to test
|
148
|
+
renaming networks</p>
|
149
|
+
</li><li>
|
150
|
+
<p><code>vpn_network</code> A test MX network that will test modifying AutoVPN
|
151
|
+
settings</p>
|
152
|
+
</li><li>
|
153
|
+
<p><code>switch_network</code> A test MS netwok that will test things like
|
154
|
+
access policies, etc.</p>
|
155
|
+
</li><li>
|
156
|
+
<p><code>mx_serial</code> A test MX that has client traffic passing through it</p>
|
157
|
+
</li><li>
|
158
|
+
<p><code>spare_mr</code> A test MR used to claim in and out of networks</p>
|
159
|
+
</li></ul>
|
160
|
+
|
161
|
+
<p>It is recommended that you set up a test organization with test devices in
|
162
|
+
it when working with developing new functionality to this gem, as to not
|
163
|
+
potentially disturb any of your production networks.</p>
|
164
|
+
|
165
|
+
<p>Once those are set and dependencies are installed, you can run the tests
|
166
|
+
with <code> rake test </code></p>
|
167
|
+
|
168
|
+
<p>As the majority of the testing for this gem requires HTTP calls, testing is
|
169
|
+
currently run with <a href="https://github.com/vcr/vcr">VCR</a> to capture
|
170
|
+
actual HTTP responses to run the tests off of. This requires that the
|
171
|
+
environment variables you set up above are for a valid Meraki Dashboard
|
172
|
+
Organization. After running the tests for the first time, subsequent tests
|
173
|
+
will be ran off of the saved output. We would also expect subsequent test
|
174
|
+
runs to be close to instantenous, as seen below:</p>
|
175
|
+
|
176
|
+
<pre class="code ruby"><code class="ruby">➜ dashboard-api git:(master) ✗ rake test
|
177
|
+
Started with run options --seed 42405
|
178
|
+
|
179
|
+
DashAPITest
|
180
|
+
test_snmp_returns_as_array PASS (0.01s)
|
181
|
+
test_license_state_returns_as_hash PASS (0.01s)
|
182
|
+
test_api_key_is_a_string PASS (0.00s)
|
183
|
+
test_get_an_organization PASS (0.01s)
|
184
|
+
test_it_returns_as_json PASS (0.00s)
|
185
|
+
test_get_inventory_for_an_org PASS (0.01s)
|
186
|
+
test_get_license_state_for_an_org PASS (0.00s)
|
187
|
+
test_third_party_peer_returns_as_array PASS (0.01s)
|
188
|
+
test_it_is_a_dash_api PASS (0.00s)
|
189
|
+
test_current_snmp_status PASS (0.00s)
|
190
|
+
test_inventory_returns_as_array PASS (0.00s)
|
191
|
+
test_third_party_vpn_peers PASS (0.00s)
|
192
|
+
|
193
|
+
Finished in 0.05813s
|
194
|
+
12 tests, 12 assertions, 0 failures, 0 errors, 0 skips</code></pre>
|
195
|
+
|
196
|
+
<p>All of the saved HTTP responses from VCR will be saved by default in
|
197
|
+
<code>fixtures/vcr_cassettes/</code>. These <strong>should not be added /
|
198
|
+
comitted to git</strong> as they will contain all of the keys / tokens we
|
199
|
+
set as ENV variables above.</p>
|
200
|
+
</div></div>
|
201
|
+
|
202
|
+
<div id="footer">
|
203
|
+
Generated on Tue Nov 15 21:16:06 2016 by
|
204
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
205
|
+
0.9.5 (ruby-2.3.0).
|
206
|
+
</div>
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</body>
|
210
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.5</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript" charset="utf-8">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,210 @@
|
|
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
|
+
File: README
|
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 = "README";
|
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</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<iframe id="search_frame" src="class_list.html"></iframe>
|
61
|
+
|
62
|
+
<div id="content"><div id='filecontents'>
|
63
|
+
<h1 id="label-Dashboard+API+v0.1.0">Dashboard API v0.1.0</h1>
|
64
|
+
|
65
|
+
<p>A ruby implementation of the <a
|
66
|
+
href="https://documentation.meraki.com/zGeneral_Administration/Other_Topics/The_Cisco_Meraki_Dashboard_API">Meraki
|
67
|
+
Dashboard API</a></p>
|
68
|
+
|
69
|
+
<p>Documentation <a href="https://">here</a></p>
|
70
|
+
|
71
|
+
<h1 id="label-Preface">Preface</h1>
|
72
|
+
|
73
|
+
<p>The following readme is broken down into two sections: * Installing /
|
74
|
+
Usage of the gem * Contributing to development of the gem</p>
|
75
|
+
|
76
|
+
<h1 id="label-Installation+and+Normal+Usage">Installation and Normal Usage</h1>
|
77
|
+
|
78
|
+
<h2 id="label-Usage">Usage</h2>
|
79
|
+
|
80
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_dashboard'>dashboard</span><span class='op'>-</span><span class='id identifier rubyid_api'>api</span>
|
81
|
+
</code></pre>
|
82
|
+
|
83
|
+
<p>Once the gem is installed, you can use it by requiring
|
84
|
+
<code>dashboard-api</code> <code> require 'dashboard-api' =>
|
85
|
+
true </code></p>
|
86
|
+
|
87
|
+
<h2 id="label-Examples">Examples</h2>
|
88
|
+
|
89
|
+
<p>It is highly recommended that you utilize environment variables when
|
90
|
+
dealing with things like API keys, tokens, etc. instead of utilizing them
|
91
|
+
directly in a script. All examples will be shown with this convention.</p>
|
92
|
+
|
93
|
+
<h3 id="label-Instantiating+a+new+instance-3A">Instantiating a new instance:</h3>
|
94
|
+
|
95
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_dapi'>dapi</span> <span class='op'>=</span> <span class='const'>DashboardAPI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dashboard_api_key</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
96
|
+
</code></pre>
|
97
|
+
|
98
|
+
<h3 id="label-Listing+details+about+a+specific+network-3A">Listing details about a specific network:</h3>
|
99
|
+
|
100
|
+
<pre class="code ruby"><code class="ruby">dapi.get_single_network(ENV['vpn_network'])
|
101
|
+
=> {"id"=>"N_<OMITTED>", "organizationId"=>"<OMITTED>", "type"=>"appliance", "name"=>"vpn_test_network", "timeZone"=>"America/Los_Angeles", "tags"=>""}
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
<p>There are many times where you need to actually pass data up to the
|
105
|
+
Dashboard API, be it for creating new networks, updating device
|
106
|
+
information, etc. In situations like these, an options hash is expected to
|
107
|
+
be passed alongside to the method call. The Dashboard-API gem documentation
|
108
|
+
mentions what is expected in the option hash for methods that require it,
|
109
|
+
but the offical <a
|
110
|
+
href="https://dashboard.meraki.com/manage/support/api_docs">Meraki
|
111
|
+
Dashboard API documentation</a> is recommended for exact details.</p>
|
112
|
+
|
113
|
+
<h3 id="label-Creating+a+new+network-3A">Creating a new network:</h3>
|
114
|
+
|
115
|
+
<pre class="code ruby"><code class="ruby">options = {:name => 'new_test_network', :type => 'wireless'}
|
116
|
+
=> {:name=>"new_test_network", :type=>"wireless"}
|
117
|
+
dapi.create_network(ENV['dashboard_org_id'], options)
|
118
|
+
=> {"id"=>"N_<OMITTED>", "organizationId"=>"<OMITTED>", "type"=>"wireless", "name"=>"new_test_network", "timeZone"=>"America/Los_Angeles", "tags"=>""}
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
<p>Not every method call will return a Hash object. Some will return an Array,
|
122
|
+
often containing a Hash in each element. Information about what is expected
|
123
|
+
to be returned can be found in the Dashboard-API Documentation, as well as
|
124
|
+
the official Meraki Dashboard API help documentation.</p>
|
125
|
+
|
126
|
+
<pre class="code ruby"><code class="ruby">dapi.get_third_party_peers(ENV['dashboard_org_id'])
|
127
|
+
=> [{"name"=>"test_api_peer", "publicIp"=>"10.0.0.1", "privateSubnets"=>["10.1.0.0/24"], "secret"=>"password", "tags"=>["all"]}, {"name"=>"second_api_peerr", "publicIp"=>"10.0.0.2", "privateSubnets"=>["10.2.0.0/24"], "secret"=>"password", "tags"=>["api_test"]}]
|
128
|
+
</code></pre>
|
129
|
+
|
130
|
+
<h1 id="label-Development">Development</h1>
|
131
|
+
|
132
|
+
<h2 id="label-Testing">Testing</h2>
|
133
|
+
|
134
|
+
<p>To install the necessary dependencies run: <code> bundle install </code> If
|
135
|
+
you do not use bundler, you can check out the gemfile, and install the
|
136
|
+
dependencies individually as necessary.</p>
|
137
|
+
|
138
|
+
<p>The Meraki Dashboard API requires both an API key, as well as certain
|
139
|
+
identifiers such as Organization, or Network IDs. If you would like to run
|
140
|
+
the full current test suite, the following ENV variables need to be set:</p>
|
141
|
+
<ul><li>
|
142
|
+
<p><code>dashboard_api_key</code> Your Meraki Dashboard API key</p>
|
143
|
+
</li><li>
|
144
|
+
<p><code>dashboard_org_id</code> The Meraki Dashboard Organization ID you will
|
145
|
+
be testing on</p>
|
146
|
+
</li><li>
|
147
|
+
<p><code>test_network_id</code> A test network ID that will be used to test
|
148
|
+
renaming networks</p>
|
149
|
+
</li><li>
|
150
|
+
<p><code>vpn_network</code> A test MX network that will test modifying AutoVPN
|
151
|
+
settings</p>
|
152
|
+
</li><li>
|
153
|
+
<p><code>switch_network</code> A test MS netwok that will test things like
|
154
|
+
access policies, etc.</p>
|
155
|
+
</li><li>
|
156
|
+
<p><code>mx_serial</code> A test MX that has client traffic passing through it</p>
|
157
|
+
</li><li>
|
158
|
+
<p><code>spare_mr</code> A test MR used to claim in and out of networks</p>
|
159
|
+
</li></ul>
|
160
|
+
|
161
|
+
<p>It is recommended that you set up a test organization with test devices in
|
162
|
+
it when working with developing new functionality to this gem, as to not
|
163
|
+
potentially disturb any of your production networks.</p>
|
164
|
+
|
165
|
+
<p>Once those are set and dependencies are installed, you can run the tests
|
166
|
+
with <code> rake test </code></p>
|
167
|
+
|
168
|
+
<p>As the majority of the testing for this gem requires HTTP calls, testing is
|
169
|
+
currently run with <a href="https://github.com/vcr/vcr">VCR</a> to capture
|
170
|
+
actual HTTP responses to run the tests off of. This requires that the
|
171
|
+
environment variables you set up above are for a valid Meraki Dashboard
|
172
|
+
Organization. After running the tests for the first time, subsequent tests
|
173
|
+
will be ran off of the saved output. We would also expect subsequent test
|
174
|
+
runs to be close to instantenous, as seen below:</p>
|
175
|
+
|
176
|
+
<pre class="code ruby"><code class="ruby">➜ dashboard-api git:(master) ✗ rake test
|
177
|
+
Started with run options --seed 42405
|
178
|
+
|
179
|
+
DashAPITest
|
180
|
+
test_snmp_returns_as_array PASS (0.01s)
|
181
|
+
test_license_state_returns_as_hash PASS (0.01s)
|
182
|
+
test_api_key_is_a_string PASS (0.00s)
|
183
|
+
test_get_an_organization PASS (0.01s)
|
184
|
+
test_it_returns_as_json PASS (0.00s)
|
185
|
+
test_get_inventory_for_an_org PASS (0.01s)
|
186
|
+
test_get_license_state_for_an_org PASS (0.00s)
|
187
|
+
test_third_party_peer_returns_as_array PASS (0.01s)
|
188
|
+
test_it_is_a_dash_api PASS (0.00s)
|
189
|
+
test_current_snmp_status PASS (0.00s)
|
190
|
+
test_inventory_returns_as_array PASS (0.00s)
|
191
|
+
test_third_party_vpn_peers PASS (0.00s)
|
192
|
+
|
193
|
+
Finished in 0.05813s
|
194
|
+
12 tests, 12 assertions, 0 failures, 0 errors, 0 skips</code></pre>
|
195
|
+
|
196
|
+
<p>All of the saved HTTP responses from VCR will be saved by default in
|
197
|
+
<code>fixtures/vcr_cassettes/</code>. These <strong>should not be added /
|
198
|
+
comitted to git</strong> as they will contain all of the keys / tokens we
|
199
|
+
set as ENV variables above.</p>
|
200
|
+
</div></div>
|
201
|
+
|
202
|
+
<div id="footer">
|
203
|
+
Generated on Tue Nov 15 21:16:06 2016 by
|
204
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
205
|
+
0.9.5 (ruby-2.3.0).
|
206
|
+
</div>
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</body>
|
210
|
+
</html>
|