apiaryio 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  apiaryio
2
2
  =============
3
3
 
4
- Apiary.io CLI
4
+ Apiary.io CLI
5
5
 
6
6
  [![Build Status](https://travis-ci.org/apiaryio/apiary-client.png?branch=master)](https://travis-ci.org/apiaryio/apiary-client)
7
7
 
@@ -29,13 +29,14 @@ machine, either using static files or using a standalone web server...
29
29
 
30
30
  preview Show API documentation in default browser
31
31
  preview --browser [chrome|safari|firefox] Show API documentation in specified browser
32
+ preview --output [FILE] Write generated HTML into specified file
32
33
  preview --path [PATH] Specify path to blueprint file
33
34
  preview --api_host [HOST] Specify apiary host
34
35
  preview --server Start standalone web server on port 8080
35
36
  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
-
37
+ publish --api-name [API_NAME] Publish apiary.apib on docs.API_NAME.apiary.io
38
+ fetch --api-name [API_NAME] Fetch apiary.apib from API_NAME.apiary.io
39
+
39
40
  help Show help
40
41
 
41
42
  version Show version
data/doc/Apiary.html CHANGED
@@ -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'>&quot;</span><span class='tstring_content'>0.0.9</span><span class='tstring_end'>&quot;</span></span></pre></dd>
109
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
110
 
111
111
  </dl>
112
112
 
@@ -122,7 +122,7 @@
122
122
  </div>
123
123
 
124
124
  <div id="footer">
125
- Generated on Sat Jan 25 12:41:41 2014 by
125
+ Generated on Thu Apr 17 13:30:51 2014 by
126
126
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
127
127
  0.8.7.3 (ruby-2.1.0).
128
128
  </div>
data/doc/Apiary/CLI.html CHANGED
@@ -199,7 +199,7 @@
199
199
  <li class="public ">
200
200
  <span class="summary_signature">
201
201
 
202
- <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(args, options) </a>
202
+ <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong>(options) </a>
203
203
 
204
204
 
205
205
 
@@ -253,14 +253,16 @@
253
253
  8
254
254
  9
255
255
  10
256
- 11</pre>
256
+ 11
257
+ 12</pre>
257
258
  </td>
258
259
  <td>
259
260
  <pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 8</span>
260
261
 
261
262
  <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>
262
263
  <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>
263
- <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>
264
+ <span class='ivar'>@command</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:command</span><span class='rparen'>)</span>
265
+ <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
264
266
  <span class='kw'>end</span></pre>
265
267
  </td>
266
268
  </tr>
@@ -337,6 +339,7 @@
337
339
  <pre class="lines">
338
340
 
339
341
 
342
+ 18
340
343
  19
341
344
  20
342
345
  21
@@ -385,53 +388,80 @@
385
388
  64
386
389
  65
387
390
  66
388
- 67</pre>
391
+ 67
392
+ 68
393
+ 69
394
+ 70
395
+ 71
396
+ 72
397
+ 73
398
+ 74
399
+ 75
400
+ 76
401
+ 77
402
+ 78
403
+ 79
404
+ 80</pre>
389
405
  </td>
390
406
  <td>
391
- <pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 19</span>
407
+ <pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 18</span>
392
408
 
393
409
  <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>
394
- <span class='ivar'>@command</span> <span class='op'>=</span> <span class='kw'>nil</span>
395
410
  <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
411
+ <span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='kw'>nil</span>
412
+ <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>&amp;&amp;</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='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
413
+ <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>
414
+ <span class='kw'>end</span>
415
+
396
416
  <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>
397
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'>&quot;</span><span class='tstring_content'>--path [PATH]</span><span class='tstring_end'>&quot;</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>
418
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>fetch</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>publish</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_command'>command</span>
398
419
  <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
420
  <span class='kw'>end</span>
400
421
 
401
422
  <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'>&quot;</span><span class='tstring_content'>--output [PATH]</span><span class='tstring_end'>&quot;</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>
423
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>fetch</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_command'>command</span>
424
+ <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>
403
425
  <span class='kw'>end</span>
404
426
 
405
427
  <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'>&quot;</span><span class='tstring_content'>--api_host API_HOST</span><span class='tstring_end'>&quot;</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>
428
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>fetch</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>publish</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_command'>command</span>
406
429
  <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>
407
430
  <span class='kw'>end</span>
408
431
 
409
432
  <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'>&quot;</span><span class='tstring_content'>--api-name API_HOST</span><span class='tstring_end'>&quot;</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>
433
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>fetch</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>publish</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_command'>command</span>
410
434
  <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
435
  <span class='kw'>end</span>
412
436
 
413
437
  <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'>&quot;</span><span class='tstring_content'>--browser BROWSER</span><span class='tstring_end'>&quot;</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>
438
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span>
414
439
  <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>
415
440
  <span class='kw'>end</span>
416
441
 
417
442
  <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'>&quot;</span><span class='tstring_content'>--server</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
443
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span>
418
444
  <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:server</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
419
445
  <span class='kw'>end</span>
420
446
 
421
447
  <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'>&quot;</span><span class='tstring_content'>--port [PORT]</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_port'>port</span><span class='op'>|</span>
448
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>fetch</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>preview</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>publish</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_command'>command</span>
422
449
  <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>
423
450
  <span class='kw'>end</span>
424
451
 
425
452
  <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'>&#39;</span><span class='tstring_content'>-v</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--version</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
426
- <span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:version</span>
453
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span>
454
+ <span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='symbol'>:version</span>
427
455
  <span class='kw'>end</span>
428
456
 
429
457
  <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'>&#39;</span><span class='tstring_content'>-h</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>--help</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>do</span>
430
- <span class='ivar'>@command</span> <span class='op'>=</span> <span class='symbol'>:help</span>
458
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='kw'>if</span> <span class='id identifier rubyid_command'>command</span>
459
+ <span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='symbol'>:help</span>
431
460
  <span class='kw'>end</span>
432
461
  <span class='kw'>end</span>
433
462
 
434
463
  <span class='id identifier rubyid_options_parser'>options_parser</span><span class='period'>.</span><span class='id identifier rubyid_parse!'>parse!</span>
464
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:command</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span> <span class='op'>||</span> <span class='symbol'>:help</span>
435
465
  <span class='id identifier rubyid_options'>options</span>
436
466
 
437
467
  <span class='kw'>rescue</span> <span class='const'>OptionParser</span><span class='op'>::</span><span class='const'>InvalidOption</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
@@ -447,7 +477,7 @@
447
477
  <div class="method_details ">
448
478
  <h3 class="signature " id="run-instance_method">
449
479
 
450
- - (<tt>Object</tt>) <strong>run</strong>(args, options)
480
+ - (<tt>Object</tt>) <strong>run</strong>(options)
451
481
 
452
482
 
453
483
 
@@ -459,19 +489,15 @@
459
489
  <pre class="lines">
460
490
 
461
491
 
462
- 13
463
492
  14
464
493
  15
465
- 16
466
- 17</pre>
494
+ 16</pre>
467
495
  </td>
468
496
  <td>
469
- <pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 13</span>
497
+ <pre class="code"><span class="info file"># File 'lib/apiary/cli.rb', line 14</span>
470
498
 
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>
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>
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>
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>
499
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
500
+ <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='ivar'>@command</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
475
501
  <span class='kw'>end</span></pre>
476
502
  </td>
477
503
  </tr>
@@ -483,7 +509,7 @@
483
509
  </div>
484
510
 
485
511
  <div id="footer">
486
- Generated on Sat Jan 25 12:41:41 2014 by
512
+ Generated on Thu Apr 17 13:30:51 2014 by
487
513
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
488
514
  0.8.7.3 (ruby-2.1.0).
489
515
  </div>
@@ -108,7 +108,7 @@
108
108
  </div>
109
109
 
110
110
  <div id="footer">
111
- Generated on Sat Jan 25 12:41:41 2014 by
111
+ Generated on Thu Apr 17 13:30:51 2014 by
112
112
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
113
113
  0.8.7.3 (ruby-2.1.0).
114
114
  </div>
@@ -277,6 +277,28 @@
277
277
 
278
278
 
279
279
 
280
+ <span class="summary_desc"><div class='inline'></div></span>
281
+
282
+ </li>
283
+
284
+
285
+ <li class="public ">
286
+ <span class="summary_signature">
287
+
288
+ <a href="#write_generated_path-instance_method" title="#write_generated_path (instance method)">- (Object) <strong>write_generated_path</strong>(data, outfile) </a>
289
+
290
+
291
+
292
+ </span>
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
280
302
  <span class="summary_desc"><div class='inline'></div></span>
281
303
 
282
304
  </li>
@@ -326,7 +348,8 @@
326
348
  24
327
349
  25
328
350
  26
329
- 27</pre>
351
+ 27
352
+ 28</pre>
330
353
  </td>
331
354
  <td>
332
355
  <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 15</span>
@@ -338,6 +361,7 @@
338
361
  <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
362
  <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
363
  <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'>&#39;</span><span class='tstring_content'>APIARY_API_KEY</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
364
+ <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_proxy'>proxy</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>http_proxy</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
341
365
  <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
366
  <span class='symbol'>:accept</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>text/html</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
343
367
  <span class='symbol'>:content_type</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>text/plain</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
@@ -419,15 +443,21 @@
419
443
  <pre class="lines">
420
444
 
421
445
 
422
- 29
423
446
  30
424
- 31</pre>
447
+ 31
448
+ 32
449
+ 33
450
+ 34
451
+ 35</pre>
425
452
  </td>
426
453
  <td>
427
- <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 29</span>
454
+ <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 30</span>
428
455
 
429
456
  <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>
457
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <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>
458
+ <span class='kw'>if</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_instance_of?'>instance_of?</span> <span class='const'>String</span>
459
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_response'>response</span>
460
+ <span class='kw'>end</span>
431
461
  <span class='kw'>end</span></pre>
432
462
  </td>
433
463
  </tr>
@@ -455,10 +485,6 @@
455
485
  <pre class="lines">
456
486
 
457
487
 
458
- 33
459
- 34
460
- 35
461
- 36
462
488
  37
463
489
  38
464
490
  39
@@ -466,10 +492,18 @@
466
492
  41
467
493
  42
468
494
  43
469
- 44</pre>
495
+ 44
496
+ 45
497
+ 46
498
+ 47
499
+ 48
500
+ 49
501
+ 50
502
+ 51
503
+ 52</pre>
470
504
  </td>
471
505
  <td>
472
- <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 33</span>
506
+ <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 37</span>
473
507
 
474
508
  <span class='kw'>def</span> <span class='id identifier rubyid_fetch_from_apiary'>fetch_from_apiary</span>
475
509
  <span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span>
@@ -480,8 +514,12 @@
480
514
  <span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>&quot;</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'>&quot;</span></span>
481
515
  <span class='kw'>end</span>
482
516
 
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'>&quot;</span><span class='tstring_content'>code</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
517
+ <span class='id identifier rubyid_response'>response</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>
518
+ <span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_output'>output</span>
519
+ <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>code</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
520
+ <span class='kw'>else</span>
521
+ <span class='id identifier rubyid_write_generated_path'>write_generated_path</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>code</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
522
+ <span class='kw'>end</span>
485
523
  <span class='kw'>end</span></pre>
486
524
  </td>
487
525
  </tr>
@@ -503,12 +541,12 @@
503
541
  <pre class="lines">
504
542
 
505
543
 
506
- 46
507
- 47
508
- 48</pre>
544
+ 54
545
+ 55
546
+ 56</pre>
509
547
  </td>
510
548
  <td>
511
- <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 46</span>
549
+ <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 54</span>
512
550
 
513
551
  <span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
514
552
  <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'>&quot;</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'>&quot;</span></span>
@@ -533,29 +571,71 @@
533
571
  <pre class="lines">
534
572
 
535
573
 
536
- 50
537
- 51
538
- 52
539
- 53
540
- 54
541
- 55
542
- 56
543
- 57</pre>
574
+ 58
575
+ 59
576
+ 60
577
+ 61
578
+ 62
579
+ 63
580
+ 64
581
+ 65
582
+ 66
583
+ 67
584
+ 68
585
+ 69</pre>
544
586
  </td>
545
587
  <td>
546
- <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 50</span>
588
+ <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 58</span>
547
589
 
548
590
  <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
591
  <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</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'>&quot;</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'>&quot;</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'>&quot;</span></span>
553
- <span class='kw'>end</span>
592
+ <span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier rubyid_proxy'>proxy</span> <span class='op'>=</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_proxy'>proxy</span>
593
+
594
+ <span class='kw'>begin</span>
595
+ <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>
596
+ <span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
597
+ <span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Apiary service responded with an error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
598
+ <span class='kw'>end</span>
599
+
554
600
  <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
601
  <span class='kw'>end</span></pre>
556
602
  </td>
557
603
  </tr>
558
604
  </table>
605
+ </div>
606
+
607
+ <div class="method_details ">
608
+ <h3 class="signature " id="write_generated_path-instance_method">
609
+
610
+ - (<tt>Object</tt>) <strong>write_generated_path</strong>(data, outfile)
611
+
612
+
613
+
614
+
615
+
616
+ </h3><table class="source_code">
617
+ <tr>
618
+ <td>
619
+ <pre class="lines">
620
+
621
+
622
+ 71
623
+ 72
624
+ 73
625
+ 74
626
+ 75</pre>
627
+ </td>
628
+ <td>
629
+ <pre class="code"><span class="info file"># File 'lib/apiary/command/fetch.rb', line 71</span>
630
+
631
+ <span class='kw'>def</span> <span class='id identifier rubyid_write_generated_path'>write_generated_path</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_outfile'>outfile</span><span class='rparen'>)</span>
632
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_outfile'>outfile</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>w</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span>
633
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
634
+ <span class='kw'>end</span>
635
+ <span class='kw'>end</span></pre>
636
+ </td>
637
+ </tr>
638
+ </table>
559
639
  </div>
560
640
 
561
641
  </div>
@@ -563,7 +643,7 @@
563
643
  </div>
564
644
 
565
645
  <div id="footer">
566
- Generated on Sat Jan 25 12:41:41 2014 by
646
+ Generated on Thu Apr 17 13:30:52 2014 by
567
647
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
568
648
  0.8.7.3 (ruby-2.1.0).
569
649
  </div>
@@ -327,7 +327,7 @@
327
327
  </div>
328
328
 
329
329
  <div id="footer">
330
- Generated on Sat Jan 25 12:41:41 2014 by
330
+ Generated on Thu Apr 17 13:30:51 2014 by
331
331
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
332
332
  0.8.7.3 (ruby-2.1.0).
333
333
  </div>