apiaryio 0.0.8 → 0.0.9
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.
- data/.gitignore +1 -0
- data/.travis.yml +3 -4
- data/Gemfile +5 -0
- data/README.md +6 -2
- data/apiary.gemspec +4 -3
- data/doc/Apiary.html +7 -7
- data/doc/Apiary/CLI.html +44 -32
- data/doc/Apiary/Command.html +7 -7
- data/doc/Apiary/Command/Fetch.html +572 -0
- data/doc/Apiary/Command/Help.html +16 -11
- data/doc/Apiary/Command/Preview.html +175 -216
- data/doc/Apiary/Command/Publish.html +634 -0
- data/doc/Apiary/Command/Runner.html +8 -9
- data/doc/Apiary/Command/Version.html +7 -8
- data/doc/_index.html +28 -6
- data/doc/class_list.html +3 -2
- data/doc/css/style.css +11 -1
- data/doc/file.README.html +37 -22
- data/doc/file_list.html +2 -1
- data/doc/frames.html +5 -7
- data/doc/index.html +37 -22
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +7 -2
- data/doc/method_list.html +112 -89
- data/doc/top-level-namespace.html +5 -5
- data/lib/apiary/command/fetch.rb +79 -0
- data/lib/apiary/command/help.rb +1 -0
- data/lib/apiary/version.rb +1 -1
- data/spec/command/fetch_spec.rb +87 -0
- data/spec/spec_helper.rb +1 -0
- metadata +121 -85
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@ apiaryio
|
|
|
3
3
|
|
|
4
4
|
Apiary.io CLI
|
|
5
5
|
|
|
6
|
-
[](https://travis-ci.org/apiaryio/apiary-client)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
## Install
|
|
@@ -33,13 +33,16 @@ machine, either using static files or using a standalone web server...
|
|
|
33
33
|
preview --api_host [HOST] Specify apiary host
|
|
34
34
|
preview --server Start standalone web server on port 8080
|
|
35
35
|
preview --server --port [PORT] Start standalone web server on specified port
|
|
36
|
+
publish --api-name [API_NAME] Publish apiary.apib on docs.API_NAME.apiary.io"
|
|
37
|
+
fetch --api-name [API_NAME] Fetch apiary.apib from API_NAME.apiary.io"
|
|
38
|
+
|
|
36
39
|
help Show help
|
|
37
40
|
|
|
38
41
|
version Show version
|
|
39
42
|
|
|
40
43
|
## Copyright
|
|
41
44
|
|
|
42
|
-
Copyright 2012-
|
|
45
|
+
Copyright 2012-14 (c) Apiary Ltd.
|
|
43
46
|
|
|
44
47
|
## Contributors
|
|
45
48
|
|
|
@@ -48,6 +51,7 @@ Copyright 2012-13 (c) Apiary Ltd.
|
|
|
48
51
|
- Lukáš Linhart
|
|
49
52
|
- Emili Parreño
|
|
50
53
|
- Peter Grilli [Tu1ly]
|
|
54
|
+
- Ladislav Prskavec
|
|
51
55
|
|
|
52
56
|
## License
|
|
53
57
|
|
data/apiary.gemspec
CHANGED
|
@@ -17,10 +17,11 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
gem.version = Apiary::VERSION
|
|
18
18
|
|
|
19
19
|
gem.add_dependency "rest-client", "~> 1.6.7"
|
|
20
|
-
gem.add_dependency "rack", "
|
|
20
|
+
gem.add_dependency "rack", ">= 1.4.0", "< 1.6.0"
|
|
21
21
|
gem.add_dependency "rake"
|
|
22
22
|
|
|
23
|
-
gem.add_development_dependency "rspec"
|
|
24
|
-
gem.add_development_dependency "
|
|
23
|
+
gem.add_development_dependency "rspec"
|
|
24
|
+
gem.add_development_dependency "webmock"
|
|
25
|
+
gem.add_development_dependency "yard"
|
|
25
26
|
|
|
26
27
|
end
|
data/doc/Apiary.html
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Apiary
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
|
82
82
|
<dd class="r1 last">lib/apiary.rb<span class="defines">,<br />
|
|
83
|
-
lib/apiary/cli.rb,<br /> lib/apiary/version.rb,<br /> lib/apiary/command/help.rb,<br /> lib/apiary/command/runner.rb,<br /> lib/apiary/command/version.rb,<br /> lib/apiary/command/preview.rb</span>
|
|
83
|
+
lib/apiary/cli.rb,<br /> lib/apiary/version.rb,<br /> lib/apiary/command/help.rb,<br /> lib/apiary/command/fetch.rb,<br /> lib/apiary/command/runner.rb,<br /> lib/apiary/command/version.rb,<br /> lib/apiary/command/preview.rb,<br /> lib/apiary/command/publish.rb</span>
|
|
84
84
|
</dd>
|
|
85
85
|
|
|
86
86
|
</dl>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<dt id="VERSION-constant" class="">VERSION =
|
|
107
107
|
|
|
108
108
|
</dt>
|
|
109
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.
|
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.9</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
110
110
|
|
|
111
111
|
</dl>
|
|
112
112
|
|
|
@@ -122,9 +122,9 @@
|
|
|
122
122
|
</div>
|
|
123
123
|
|
|
124
124
|
<div id="footer">
|
|
125
|
-
Generated on
|
|
125
|
+
Generated on Sat Jan 25 12:41:41 2014 by
|
|
126
126
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
127
|
-
0.8.
|
|
127
|
+
0.8.7.3 (ruby-2.1.0).
|
|
128
128
|
</div>
|
|
129
129
|
|
|
130
130
|
</body>
|
data/doc/Apiary/CLI.html
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Apiary::CLI
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
@@ -128,9 +128,8 @@
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
<span class="summary_desc"><div class='inline'
|
|
132
|
-
Returns the value of attribute command
|
|
133
|
-
</p>
|
|
131
|
+
<span class="summary_desc"><div class='inline'>
|
|
132
|
+
<p>Returns the value of attribute command.</p>
|
|
134
133
|
</div></span>
|
|
135
134
|
|
|
136
135
|
</li>
|
|
@@ -168,9 +167,8 @@ Returns the value of attribute command.
|
|
|
168
167
|
|
|
169
168
|
|
|
170
169
|
|
|
171
|
-
<span class="summary_desc"><div class='inline'
|
|
172
|
-
A new instance of CLI
|
|
173
|
-
</p>
|
|
170
|
+
<span class="summary_desc"><div class='inline'>
|
|
171
|
+
<p>A new instance of CLI.</p>
|
|
174
172
|
</div></span>
|
|
175
173
|
|
|
176
174
|
</li>
|
|
@@ -237,9 +235,8 @@ A new instance of CLI.
|
|
|
237
235
|
|
|
238
236
|
</h3><div class="docstring">
|
|
239
237
|
<div class="discussion">
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
</p>
|
|
238
|
+
|
|
239
|
+
<p>Returns a new instance of CLI</p>
|
|
243
240
|
|
|
244
241
|
|
|
245
242
|
</div>
|
|
@@ -253,13 +250,13 @@ A new instance of CLI
|
|
|
253
250
|
<pre class="lines">
|
|
254
251
|
|
|
255
252
|
|
|
253
|
+
8
|
|
256
254
|
9
|
|
257
255
|
10
|
|
258
|
-
11
|
|
259
|
-
12</pre>
|
|
256
|
+
11</pre>
|
|
260
257
|
</td>
|
|
261
258
|
<td>
|
|
262
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line
|
|
259
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 8</span>
|
|
263
260
|
|
|
264
261
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
265
262
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_options!'>parse_options!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
@@ -288,9 +285,8 @@ A new instance of CLI
|
|
|
288
285
|
|
|
289
286
|
</h3><div class="docstring">
|
|
290
287
|
<div class="discussion">
|
|
291
|
-
|
|
292
|
-
Returns the value of attribute command
|
|
293
|
-
</p>
|
|
288
|
+
|
|
289
|
+
<p>Returns the value of attribute command</p>
|
|
294
290
|
|
|
295
291
|
|
|
296
292
|
</div>
|
|
@@ -304,12 +300,12 @@ Returns the value of attribute command
|
|
|
304
300
|
<pre class="lines">
|
|
305
301
|
|
|
306
302
|
|
|
303
|
+
6
|
|
307
304
|
7
|
|
308
|
-
8
|
|
309
|
-
9</pre>
|
|
305
|
+
8</pre>
|
|
310
306
|
</td>
|
|
311
307
|
<td>
|
|
312
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line
|
|
308
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 6</span>
|
|
313
309
|
|
|
314
310
|
<span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span>
|
|
315
311
|
<span class='ivar'>@command</span>
|
|
@@ -341,6 +337,7 @@ Returns the value of attribute command
|
|
|
341
337
|
<pre class="lines">
|
|
342
338
|
|
|
343
339
|
|
|
340
|
+
19
|
|
344
341
|
20
|
|
345
342
|
21
|
|
346
343
|
22
|
|
@@ -381,23 +378,38 @@ Returns the value of attribute command
|
|
|
381
378
|
57
|
|
382
379
|
58
|
|
383
380
|
59
|
|
384
|
-
60
|
|
381
|
+
60
|
|
382
|
+
61
|
|
383
|
+
62
|
|
384
|
+
63
|
|
385
|
+
64
|
|
386
|
+
65
|
|
387
|
+
66
|
|
388
|
+
67</pre>
|
|
385
389
|
</td>
|
|
386
390
|
<td>
|
|
387
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line
|
|
391
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 19</span>
|
|
388
392
|
|
|
389
393
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_options!'>parse_options!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
390
394
|
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
391
395
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
392
396
|
<span class='id identifier rubyid_options_parser'>options_parser</span> <span class='op'>=</span> <span class='const'>OptionParser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_opts'>opts</span><span class='op'>|</span>
|
|
393
397
|
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--path [PATH]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
|
394
|
-
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:
|
|
398
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:path</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
|
399
|
+
<span class='kw'>end</span>
|
|
400
|
+
|
|
401
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--output [PATH]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
|
402
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:output</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
|
395
403
|
<span class='kw'>end</span>
|
|
396
404
|
|
|
397
405
|
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--api_host API_HOST</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_api_host'>api_host</span><span class='op'>|</span>
|
|
398
406
|
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:api_host</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_api_host'>api_host</span>
|
|
399
407
|
<span class='kw'>end</span>
|
|
400
408
|
|
|
409
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--api-name API_HOST</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_api_name'>api_name</span><span class='op'>|</span>
|
|
410
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:api_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_api_name'>api_name</span>
|
|
411
|
+
<span class='kw'>end</span>
|
|
412
|
+
|
|
401
413
|
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>--browser BROWSER</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_browser'>browser</span><span class='op'>|</span>
|
|
402
414
|
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:browser</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_browser'>browser</span>
|
|
403
415
|
<span class='kw'>end</span>
|
|
@@ -410,11 +422,11 @@ Returns the value of attribute command
|
|
|
410
422
|
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_port'>port</span>
|
|
411
423
|
<span class='kw'>end</span>
|
|
412
424
|
|
|
413
|
-
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'
|
|
425
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-v</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--version</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
414
426
|
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:version</span>
|
|
415
427
|
<span class='kw'>end</span>
|
|
416
428
|
|
|
417
|
-
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'
|
|
429
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-h</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
418
430
|
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:help</span>
|
|
419
431
|
<span class='kw'>end</span>
|
|
420
432
|
<span class='kw'>end</span>
|
|
@@ -447,17 +459,17 @@ Returns the value of attribute command
|
|
|
447
459
|
<pre class="lines">
|
|
448
460
|
|
|
449
461
|
|
|
462
|
+
13
|
|
450
463
|
14
|
|
451
464
|
15
|
|
452
465
|
16
|
|
453
|
-
17
|
|
454
|
-
18</pre>
|
|
466
|
+
17</pre>
|
|
455
467
|
</td>
|
|
456
468
|
<td>
|
|
457
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line
|
|
469
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 13</span>
|
|
458
470
|
|
|
459
471
|
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
460
|
-
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
472
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>||</span> <span class='symbol'>:help</span>
|
|
461
473
|
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='ivar'>@command</span> <span class='kw'>if</span> <span class='ivar'>@command</span>
|
|
462
474
|
<span class='const'>Apiary</span><span class='op'>::</span><span class='const'>Command</span><span class='op'>::</span><span class='const'>Runner</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
463
475
|
<span class='kw'>end</span></pre>
|
|
@@ -471,9 +483,9 @@ Returns the value of attribute command
|
|
|
471
483
|
</div>
|
|
472
484
|
|
|
473
485
|
<div id="footer">
|
|
474
|
-
Generated on
|
|
486
|
+
Generated on Sat Jan 25 12:41:41 2014 by
|
|
475
487
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
476
|
-
0.8.
|
|
488
|
+
0.8.7.3 (ruby-2.1.0).
|
|
477
489
|
</div>
|
|
478
490
|
|
|
479
491
|
</body>
|
data/doc/Apiary/Command.html
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Apiary::Command
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
|
82
82
|
<dd class="r1 last">lib/apiary/command/help.rb<span class="defines">,<br />
|
|
83
|
-
lib/apiary/command/runner.rb,<br /> lib/apiary/command/version.rb,<br /> lib/apiary/command/preview.rb</span>
|
|
83
|
+
lib/apiary/command/fetch.rb,<br /> lib/apiary/command/runner.rb,<br /> lib/apiary/command/version.rb,<br /> lib/apiary/command/preview.rb,<br /> lib/apiary/command/publish.rb</span>
|
|
84
84
|
</dd>
|
|
85
85
|
|
|
86
86
|
</dl>
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Command/Help.html" title="Apiary::Command::Help (class)">Help</a></span>, <span class='object_link'><a href="Command/Preview.html" title="Apiary::Command::Preview (class)">Preview</a></span>, <span class='object_link'><a href="Command/Runner.html" title="Apiary::Command::Runner (class)">Runner</a></span>, <span class='object_link'><a href="Command/Version.html" title="Apiary::Command::Version (class)">Version</a></span>
|
|
95
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Command/Fetch.html" title="Apiary::Command::Fetch (class)">Fetch</a></span>, <span class='object_link'><a href="Command/Help.html" title="Apiary::Command::Help (class)">Help</a></span>, <span class='object_link'><a href="Command/Preview.html" title="Apiary::Command::Preview (class)">Preview</a></span>, <span class='object_link'><a href="Command/Publish.html" title="Apiary::Command::Publish (class)">Publish</a></span>, <span class='object_link'><a href="Command/Runner.html" title="Apiary::Command::Runner (class)">Runner</a></span>, <span class='object_link'><a href="Command/Version.html" title="Apiary::Command::Version (class)">Version</a></span>
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
</p>
|
|
@@ -108,9 +108,9 @@
|
|
|
108
108
|
</div>
|
|
109
109
|
|
|
110
110
|
<div id="footer">
|
|
111
|
-
Generated on
|
|
111
|
+
Generated on Sat Jan 25 12:41:41 2014 by
|
|
112
112
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
113
|
-
0.8.
|
|
113
|
+
0.8.7.3 (ruby-2.1.0).
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
</body>
|
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: Apiary::Command::Fetch
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.3
|
|
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
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../_index.html">Index (F)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Apiary.html" title="Apiary (module)">Apiary</a></span></span> » <span class='title'><span class='object_link'><a href="../Command.html" title="Apiary::Command (module)">Command</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Fetch</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Class: Apiary::Command::Fetch
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
<dt class="r1">Inherits:</dt>
|
|
75
|
+
<dd class="r1">
|
|
76
|
+
<span class="inheritName">Object</span>
|
|
77
|
+
|
|
78
|
+
<ul class="fullTree">
|
|
79
|
+
<li>Object</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">Apiary::Command::Fetch</li>
|
|
82
|
+
|
|
83
|
+
</ul>
|
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
+
|
|
86
|
+
</dd>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
|
97
|
+
<dd class="r2 last">lib/apiary/command/fetch.rb</dd>
|
|
98
|
+
|
|
99
|
+
</dl>
|
|
100
|
+
<div class="clear"></div>
|
|
101
|
+
|
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
<p>Retrieve blueprint from apiary</p>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="tags">
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
|
118
|
+
<ul class="summary">
|
|
119
|
+
|
|
120
|
+
<li class="public ">
|
|
121
|
+
<span class="summary_signature">
|
|
122
|
+
|
|
123
|
+
<a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</span>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<span class="note title readonly">readonly</span>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
|
143
|
+
<p>Returns the value of attribute options.</p>
|
|
144
|
+
</div></span>
|
|
145
|
+
|
|
146
|
+
</li>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
</ul>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<h2>
|
|
156
|
+
Class Method Summary
|
|
157
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
158
|
+
</h2>
|
|
159
|
+
|
|
160
|
+
<ul class="summary">
|
|
161
|
+
|
|
162
|
+
<li class="public ">
|
|
163
|
+
<span class="summary_signature">
|
|
164
|
+
|
|
165
|
+
<a href="#execute-class_method" title="execute (class method)">+ (Object) <strong>execute</strong>(args) </a>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
</span>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
180
|
+
|
|
181
|
+
</li>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
</ul>
|
|
185
|
+
|
|
186
|
+
<h2>
|
|
187
|
+
Instance Method Summary
|
|
188
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
189
|
+
</h2>
|
|
190
|
+
|
|
191
|
+
<ul class="summary">
|
|
192
|
+
|
|
193
|
+
<li class="public ">
|
|
194
|
+
<span class="summary_signature">
|
|
195
|
+
|
|
196
|
+
<a href="#fetch_from_apiary-instance_method" title="#fetch_from_apiary (instance method)">- (Object) <strong>fetch_from_apiary</strong> </a>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
</span>
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
211
|
+
|
|
212
|
+
</li>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<li class="public ">
|
|
216
|
+
<span class="summary_signature">
|
|
217
|
+
|
|
218
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Fetch) <strong>initialize</strong>(opts) </a>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
</span>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<span class="note title constructor">constructor</span>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
<span class="summary_desc"><div class='inline'>
|
|
235
|
+
<p>TODO: use OpenStruct to store @options.</p>
|
|
236
|
+
</div></span>
|
|
237
|
+
|
|
238
|
+
</li>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<li class="public ">
|
|
242
|
+
<span class="summary_signature">
|
|
243
|
+
|
|
244
|
+
<a href="#path-instance_method" title="#path (instance method)">- (Object) <strong>path</strong> </a>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
</span>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
259
|
+
|
|
260
|
+
</li>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<li class="public ">
|
|
264
|
+
<span class="summary_signature">
|
|
265
|
+
|
|
266
|
+
<a href="#query_apiary-instance_method" title="#query_apiary (instance method)">- (Object) <strong>query_apiary</strong>(host, path) </a>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
</span>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
281
|
+
|
|
282
|
+
</li>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
</ul>
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<div id="constructor_details" class="method_details_list">
|
|
289
|
+
<h2>Constructor Details</h2>
|
|
290
|
+
|
|
291
|
+
<div class="method_details first">
|
|
292
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
293
|
+
|
|
294
|
+
- (<tt><span class='object_link'><a href="" title="Apiary::Command::Fetch (class)">Fetch</a></span></tt>) <strong>initialize</strong>(opts)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
</h3><div class="docstring">
|
|
301
|
+
<div class="discussion">
|
|
302
|
+
|
|
303
|
+
<p>TODO: use OpenStruct to store @options</p>
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
<div class="tags">
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
</div><table class="source_code">
|
|
312
|
+
<tr>
|
|
313
|
+
<td>
|
|
314
|
+
<pre class="lines">
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
15
|
|
318
|
+
16
|
|
319
|
+
17
|
|
320
|
+
18
|
|
321
|
+
19
|
|
322
|
+
20
|
|
323
|
+
21
|
|
324
|
+
22
|
|
325
|
+
23
|
|
326
|
+
24
|
|
327
|
+
25
|
|
328
|
+
26
|
|
329
|
+
27</pre>
|
|
330
|
+
</td>
|
|
331
|
+
<td>
|
|
332
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 15</span>
|
|
333
|
+
|
|
334
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
335
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
336
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>apiary.apib</span><span class='tstring_end'>"</span></span>
|
|
337
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_host'>api_host</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>api.apiary.io</span><span class='tstring_end'>"</span></span>
|
|
338
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span> <span class='op'>||=</span> <span class='int'>8080</span>
|
|
339
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span> <span class='op'>||=</span> <span class='kw'>false</span>
|
|
340
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_key'>api_key</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>APIARY_API_KEY</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
|
341
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span> <span class='op'>||=</span> <span class='lbrace'>{</span>
|
|
342
|
+
<span class='symbol'>:accept</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>text/html</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
343
|
+
<span class='symbol'>:content_type</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>text/plain</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
344
|
+
<span class='symbol'>:authentication</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Token </span><span class='embexpr_beg'>#{</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_key'>api_key</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
345
|
+
<span class='rbrace'>}</span>
|
|
346
|
+
<span class='kw'>end</span></pre>
|
|
347
|
+
</td>
|
|
348
|
+
</tr>
|
|
349
|
+
</table>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
</div>
|
|
353
|
+
|
|
354
|
+
<div id="instance_attr_details" class="attr_details">
|
|
355
|
+
<h2>Instance Attribute Details</h2>
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
<span id=""></span>
|
|
359
|
+
<div class="method_details first">
|
|
360
|
+
<h3 class="signature first" id="options-instance_method">
|
|
361
|
+
|
|
362
|
+
- (<tt>Object</tt>) <strong>options</strong> <span class="extras">(readonly)</span>
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
</h3><div class="docstring">
|
|
369
|
+
<div class="discussion">
|
|
370
|
+
|
|
371
|
+
<p>Returns the value of attribute options</p>
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
<div class="tags">
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
</div><table class="source_code">
|
|
380
|
+
<tr>
|
|
381
|
+
<td>
|
|
382
|
+
<pre class="lines">
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
12
|
|
386
|
+
13
|
|
387
|
+
14</pre>
|
|
388
|
+
</td>
|
|
389
|
+
<td>
|
|
390
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 12</span>
|
|
391
|
+
|
|
392
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
|
393
|
+
<span class='ivar'>@options</span>
|
|
394
|
+
<span class='kw'>end</span></pre>
|
|
395
|
+
</td>
|
|
396
|
+
</tr>
|
|
397
|
+
</table>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
<div id="class_method_details" class="method_details_list">
|
|
404
|
+
<h2>Class Method Details</h2>
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
<div class="method_details first">
|
|
408
|
+
<h3 class="signature first" id="execute-class_method">
|
|
409
|
+
|
|
410
|
+
+ (<tt>Object</tt>) <strong>execute</strong>(args)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
</h3><table class="source_code">
|
|
417
|
+
<tr>
|
|
418
|
+
<td>
|
|
419
|
+
<pre class="lines">
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
29
|
|
423
|
+
30
|
|
424
|
+
31</pre>
|
|
425
|
+
</td>
|
|
426
|
+
<td>
|
|
427
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 29</span>
|
|
428
|
+
|
|
429
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
430
|
+
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_fetch_from_apiary'>fetch_from_apiary</span>
|
|
431
|
+
<span class='kw'>end</span></pre>
|
|
432
|
+
</td>
|
|
433
|
+
</tr>
|
|
434
|
+
</table>
|
|
435
|
+
</div>
|
|
436
|
+
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<div id="instance_method_details" class="method_details_list">
|
|
440
|
+
<h2>Instance Method Details</h2>
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
<div class="method_details first">
|
|
444
|
+
<h3 class="signature first" id="fetch_from_apiary-instance_method">
|
|
445
|
+
|
|
446
|
+
- (<tt>Object</tt>) <strong>fetch_from_apiary</strong>
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
</h3><table class="source_code">
|
|
453
|
+
<tr>
|
|
454
|
+
<td>
|
|
455
|
+
<pre class="lines">
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
33
|
|
459
|
+
34
|
|
460
|
+
35
|
|
461
|
+
36
|
|
462
|
+
37
|
|
463
|
+
38
|
|
464
|
+
39
|
|
465
|
+
40
|
|
466
|
+
41
|
|
467
|
+
42
|
|
468
|
+
43
|
|
469
|
+
44</pre>
|
|
470
|
+
</td>
|
|
471
|
+
<td>
|
|
472
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 33</span>
|
|
473
|
+
|
|
474
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fetch_from_apiary'>fetch_from_apiary</span>
|
|
475
|
+
<span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span>
|
|
476
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Please provide an api-name option (subdomain part from your http://docs.<api-name>.apiary.io/)</span><span class='tstring_end'>"</span></span>
|
|
477
|
+
<span class='kw'>end</span>
|
|
478
|
+
|
|
479
|
+
<span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_key'>api_key</span>
|
|
480
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>API key must be provided through environment variable APIARY_API_KEY. Please go to https://login.apiary.io/tokens to obtain it.</span><span class='tstring_end'>"</span></span>
|
|
481
|
+
<span class='kw'>end</span>
|
|
482
|
+
|
|
483
|
+
<span class='id identifier rubyid_reponse'>reponse</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_query_apiary'>query_apiary</span><span class='lparen'>(</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_host'>api_host</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
|
484
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_reponse'>reponse</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>code</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
|
485
|
+
<span class='kw'>end</span></pre>
|
|
486
|
+
</td>
|
|
487
|
+
</tr>
|
|
488
|
+
</table>
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
<div class="method_details ">
|
|
492
|
+
<h3 class="signature " id="path-instance_method">
|
|
493
|
+
|
|
494
|
+
- (<tt>Object</tt>) <strong>path</strong>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
</h3><table class="source_code">
|
|
501
|
+
<tr>
|
|
502
|
+
<td>
|
|
503
|
+
<pre class="lines">
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
46
|
|
507
|
+
47
|
|
508
|
+
48</pre>
|
|
509
|
+
</td>
|
|
510
|
+
<td>
|
|
511
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 46</span>
|
|
512
|
+
|
|
513
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
|
514
|
+
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.apib</span><span class='tstring_end'>"</span></span>
|
|
515
|
+
<span class='kw'>end</span></pre>
|
|
516
|
+
</td>
|
|
517
|
+
</tr>
|
|
518
|
+
</table>
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
<div class="method_details ">
|
|
522
|
+
<h3 class="signature " id="query_apiary-instance_method">
|
|
523
|
+
|
|
524
|
+
- (<tt>Object</tt>) <strong>query_apiary</strong>(host, path)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
</h3><table class="source_code">
|
|
531
|
+
<tr>
|
|
532
|
+
<td>
|
|
533
|
+
<pre class="lines">
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
50
|
|
537
|
+
51
|
|
538
|
+
52
|
|
539
|
+
53
|
|
540
|
+
54
|
|
541
|
+
55
|
|
542
|
+
56
|
|
543
|
+
57</pre>
|
|
544
|
+
</td>
|
|
545
|
+
<td>
|
|
546
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 50</span>
|
|
547
|
+
|
|
548
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_query_apiary'>query_apiary</span><span class='lparen'>(</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
|
549
|
+
<span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>https://</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_host'>host</span><span class='embexpr_end'>}</span><span class='tstring_content'>/blueprint/get/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
550
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span>
|
|
551
|
+
<span class='kw'>unless</span> <span class='lparen'>(</span><span class='int'>200</span><span class='op'>..</span><span class='int'>299</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
|
|
552
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Request failed with code </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
553
|
+
<span class='kw'>end</span>
|
|
554
|
+
<span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
|
|
555
|
+
<span class='kw'>end</span></pre>
|
|
556
|
+
</td>
|
|
557
|
+
</tr>
|
|
558
|
+
</table>
|
|
559
|
+
</div>
|
|
560
|
+
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
</div>
|
|
564
|
+
|
|
565
|
+
<div id="footer">
|
|
566
|
+
Generated on Sat Jan 25 12:41:41 2014 by
|
|
567
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
568
|
+
0.8.7.3 (ruby-2.1.0).
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
</body>
|
|
572
|
+
</html>
|