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 +5 -4
- data/doc/Apiary.html +2 -2
- data/doc/Apiary/CLI.html +45 -19
- data/doc/Apiary/Command.html +1 -1
- data/doc/Apiary/Command/Fetch.html +111 -31
- data/doc/Apiary/Command/Help.html +1 -1
- data/doc/Apiary/Command/Preview.html +93 -65
- data/doc/Apiary/Command/Publish.html +51 -31
- data/doc/Apiary/Command/Runner.html +1 -1
- data/doc/Apiary/Command/Version.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +4 -3
- data/doc/index.html +4 -3
- data/doc/method_list.html +26 -20
- data/doc/top-level-namespace.html +1 -1
- data/lib/apiary/cli.rb +22 -9
- data/lib/apiary/command/fetch.rb +11 -6
- data/lib/apiary/command/preview.rb +16 -1
- data/lib/apiary/command/publish.rb +14 -3
- data/lib/apiary/version.rb +1 -1
- metadata +7 -5
@@ -530,16 +530,17 @@
|
|
530
530
|
<pre class="lines">
|
531
531
|
|
532
532
|
|
533
|
-
20
|
534
533
|
21
|
535
534
|
22
|
536
535
|
23
|
537
536
|
24
|
538
537
|
25
|
539
|
-
26
|
538
|
+
26
|
539
|
+
27
|
540
|
+
28</pre>
|
540
541
|
</td>
|
541
542
|
<td>
|
542
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 21</span>
|
543
544
|
|
544
545
|
<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>
|
545
546
|
<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>
|
@@ -547,6 +548,7 @@
|
|
547
548
|
<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>
|
548
549
|
<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><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> <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='rbrace'>}</span>
|
549
550
|
<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>
|
551
|
+
<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'>'</span><span class='tstring_content'>http_proxy</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
550
552
|
<span class='kw'>end</span></pre>
|
551
553
|
</td>
|
552
554
|
</tr>
|
@@ -586,12 +588,12 @@
|
|
586
588
|
<pre class="lines">
|
587
589
|
|
588
590
|
|
589
|
-
17
|
590
591
|
18
|
591
|
-
19
|
592
|
+
19
|
593
|
+
20</pre>
|
592
594
|
</td>
|
593
595
|
<td>
|
594
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
596
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 18</span>
|
595
597
|
|
596
598
|
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
597
599
|
<span class='ivar'>@options</span>
|
@@ -623,12 +625,12 @@
|
|
623
625
|
<pre class="lines">
|
624
626
|
|
625
627
|
|
626
|
-
|
627
|
-
|
628
|
-
|
628
|
+
30
|
629
|
+
31
|
630
|
+
32</pre>
|
629
631
|
</td>
|
630
632
|
<td>
|
631
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
633
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 30</span>
|
632
634
|
|
633
635
|
<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>
|
634
636
|
<span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:server</span><span class='rbracket'>]</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_server'>server</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_show'>show</span>
|
@@ -659,12 +661,12 @@
|
|
659
661
|
<pre class="lines">
|
660
662
|
|
661
663
|
|
662
|
-
|
663
|
-
|
664
|
-
|
664
|
+
52
|
665
|
+
53
|
666
|
+
54</pre>
|
665
667
|
</td>
|
666
668
|
<td>
|
667
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
669
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 52</span>
|
668
670
|
|
669
671
|
<span class='kw'>def</span> <span class='id identifier rubyid_browser'>browser</span>
|
670
672
|
<span class='const'>BROWSERS</span><span class='lbracket'>[</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_browser'>browser</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>nil</span>
|
@@ -689,15 +691,15 @@
|
|
689
691
|
<pre class="lines">
|
690
692
|
|
691
693
|
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
694
|
+
105
|
695
|
+
106
|
696
|
+
107
|
697
|
+
108
|
698
|
+
109
|
699
|
+
110</pre>
|
698
700
|
</td>
|
699
701
|
<td>
|
700
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
702
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 105</span>
|
701
703
|
|
702
704
|
<span class='kw'>def</span> <span class='id identifier rubyid_generate_static'>generate_static</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
703
705
|
<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_preview_path'>preview_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</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_file'>file</span><span class='op'>|</span>
|
@@ -736,12 +738,12 @@
|
|
736
738
|
<pre class="lines">
|
737
739
|
|
738
740
|
|
739
|
-
|
740
|
-
|
741
|
-
|
741
|
+
95
|
742
|
+
96
|
743
|
+
97</pre>
|
742
744
|
</td>
|
743
745
|
<td>
|
744
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
746
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 95</span>
|
745
747
|
|
746
748
|
<span class='kw'>def</span> <span class='id identifier rubyid_open_generated_page'>open_generated_page</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
747
749
|
<span class='id identifier rubyid_exec'>exec</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>open </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browser_options'>browser_options</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
@@ -766,12 +768,12 @@
|
|
766
768
|
<pre class="lines">
|
767
769
|
|
768
770
|
|
769
|
-
|
770
|
-
|
771
|
-
|
771
|
+
48
|
772
|
+
49
|
773
|
+
50</pre>
|
772
774
|
</td>
|
773
775
|
<td>
|
774
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
776
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 48</span>
|
775
777
|
|
776
778
|
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
777
779
|
<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>
|
@@ -796,13 +798,13 @@
|
|
796
798
|
<pre class="lines">
|
797
799
|
|
798
800
|
|
799
|
-
68
|
800
|
-
69
|
801
801
|
70
|
802
|
-
71
|
802
|
+
71
|
803
|
+
72
|
804
|
+
73</pre>
|
803
805
|
</td>
|
804
806
|
<td>
|
805
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
807
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 70</span>
|
806
808
|
|
807
809
|
<span class='kw'>def</span> <span class='id identifier rubyid_preview_path'>preview_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
808
810
|
<span class='id identifier rubyid_basename'>basename</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
@@ -828,19 +830,45 @@
|
|
828
830
|
<pre class="lines">
|
829
831
|
|
830
832
|
|
831
|
-
73
|
832
|
-
74
|
833
833
|
75
|
834
834
|
76
|
835
|
-
77
|
835
|
+
77
|
836
|
+
78
|
837
|
+
79
|
838
|
+
80
|
839
|
+
81
|
840
|
+
82
|
841
|
+
83
|
842
|
+
84
|
843
|
+
85
|
844
|
+
86
|
845
|
+
87
|
846
|
+
88
|
847
|
+
89
|
848
|
+
90
|
849
|
+
91
|
850
|
+
92</pre>
|
836
851
|
</td>
|
837
852
|
<td>
|
838
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
853
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 75</span>
|
839
854
|
|
840
855
|
<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>
|
841
856
|
<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/generate</span><span class='tstring_end'>"</span></span>
|
842
857
|
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
843
|
-
<span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier
|
858
|
+
<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>
|
859
|
+
|
860
|
+
<span class='kw'>begin</span>
|
861
|
+
<span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
862
|
+
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>BadRequest</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
863
|
+
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
|
864
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parserError</span><span class='tstring_end'>'</span></span>
|
865
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parserError</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
866
|
+
<span class='kw'>else</span>
|
867
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apiary service responded with an error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
868
|
+
<span class='kw'>end</span>
|
869
|
+
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
870
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
|
871
|
+
<span class='kw'>end</span>
|
844
872
|
<span class='kw'>end</span></pre>
|
845
873
|
</td>
|
846
874
|
</tr>
|
@@ -862,14 +890,14 @@
|
|
862
890
|
<pre class="lines">
|
863
891
|
|
864
892
|
|
865
|
-
54
|
866
|
-
55
|
867
893
|
56
|
868
894
|
57
|
869
|
-
58
|
895
|
+
58
|
896
|
+
59
|
897
|
+
60</pre>
|
870
898
|
</td>
|
871
899
|
<td>
|
872
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
900
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 56</span>
|
873
901
|
|
874
902
|
<span class='kw'>def</span> <span class='id identifier rubyid_rack_app'>rack_app</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
875
903
|
<span class='const'>Rack</span><span class='op'>::</span><span class='const'>Builder</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
@@ -896,16 +924,16 @@
|
|
896
924
|
<pre class="lines">
|
897
925
|
|
898
926
|
|
899
|
-
60
|
900
|
-
61
|
901
927
|
62
|
902
928
|
63
|
903
929
|
64
|
904
930
|
65
|
905
|
-
66
|
931
|
+
66
|
932
|
+
67
|
933
|
+
68</pre>
|
906
934
|
</td>
|
907
935
|
<td>
|
908
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
936
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 62</span>
|
909
937
|
|
910
938
|
<span class='kw'>def</span> <span class='id identifier rubyid_run_server'>run_server</span>
|
911
939
|
<span class='id identifier rubyid_app'>app</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rack_app'>rack_app</span> <span class='kw'>do</span>
|
@@ -934,12 +962,12 @@
|
|
934
962
|
<pre class="lines">
|
935
963
|
|
936
964
|
|
937
|
-
|
938
|
-
|
939
|
-
|
965
|
+
34
|
966
|
+
35
|
967
|
+
36</pre>
|
940
968
|
</td>
|
941
969
|
<td>
|
942
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
970
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 34</span>
|
943
971
|
|
944
972
|
<span class='kw'>def</span> <span class='id identifier rubyid_server'>server</span>
|
945
973
|
<span class='id identifier rubyid_run_server'>run_server</span>
|
@@ -964,12 +992,12 @@
|
|
964
992
|
<pre class="lines">
|
965
993
|
|
966
994
|
|
967
|
-
|
968
|
-
|
969
|
-
|
995
|
+
38
|
996
|
+
39
|
997
|
+
40</pre>
|
970
998
|
</td>
|
971
999
|
<td>
|
972
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
1000
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 38</span>
|
973
1001
|
|
974
1002
|
<span class='kw'>def</span> <span class='id identifier rubyid_show'>show</span>
|
975
1003
|
<span class='id identifier rubyid_generate_static'>generate_static</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
@@ -994,14 +1022,14 @@
|
|
994
1022
|
<pre class="lines">
|
995
1023
|
|
996
1024
|
|
997
|
-
40
|
998
|
-
41
|
999
1025
|
42
|
1000
1026
|
43
|
1001
|
-
44
|
1027
|
+
44
|
1028
|
+
45
|
1029
|
+
46</pre>
|
1002
1030
|
</td>
|
1003
1031
|
<td>
|
1004
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
1032
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 42</span>
|
1005
1033
|
|
1006
1034
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_apib_file'>validate_apib_file</span><span class='lparen'>(</span><span class='id identifier rubyid_apib_file'>apib_file</span><span class='rparen'>)</span>
|
1007
1035
|
<span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_apib_file'>apib_file</span><span class='rparen'>)</span>
|
@@ -1028,14 +1056,14 @@
|
|
1028
1056
|
<pre class="lines">
|
1029
1057
|
|
1030
1058
|
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1059
|
+
99
|
1060
|
+
100
|
1061
|
+
101
|
1062
|
+
102
|
1063
|
+
103</pre>
|
1036
1064
|
</td>
|
1037
1065
|
<td>
|
1038
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line
|
1066
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/preview.rb', line 99</span>
|
1039
1067
|
|
1040
1068
|
<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_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_outfile'>outfile</span><span class='rparen'>)</span>
|
1041
1069
|
<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'>'</span><span class='tstring_content'>w</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_file'>file</span><span class='op'>|</span>
|
@@ -1052,7 +1080,7 @@
|
|
1052
1080
|
</div>
|
1053
1081
|
|
1054
1082
|
<div id="footer">
|
1055
|
-
Generated on
|
1083
|
+
Generated on Thu Apr 17 13:30:52 2014 by
|
1056
1084
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1057
1085
|
0.8.7.3 (ruby-2.1.0).
|
1058
1086
|
</div>
|
@@ -336,7 +336,6 @@
|
|
336
336
|
<pre class="lines">
|
337
337
|
|
338
338
|
|
339
|
-
14
|
340
339
|
15
|
341
340
|
16
|
342
341
|
17
|
@@ -348,10 +347,12 @@
|
|
348
347
|
23
|
349
348
|
24
|
350
349
|
25
|
351
|
-
26
|
350
|
+
26
|
351
|
+
27
|
352
|
+
28</pre>
|
352
353
|
</td>
|
353
354
|
<td>
|
354
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
355
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 15</span>
|
355
356
|
|
356
357
|
<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>
|
357
358
|
<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>
|
@@ -360,6 +361,7 @@
|
|
360
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>
|
361
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>
|
362
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'>'</span><span class='tstring_content'>APIARY_API_KEY</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>http_proxy</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
363
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>
|
364
366
|
<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>
|
365
367
|
<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>
|
@@ -404,12 +406,12 @@
|
|
404
406
|
<pre class="lines">
|
405
407
|
|
406
408
|
|
407
|
-
11
|
408
409
|
12
|
409
|
-
13
|
410
|
+
13
|
411
|
+
14</pre>
|
410
412
|
</td>
|
411
413
|
<td>
|
412
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
414
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 12</span>
|
413
415
|
|
414
416
|
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
415
417
|
<span class='ivar'>@options</span>
|
@@ -441,12 +443,12 @@
|
|
441
443
|
<pre class="lines">
|
442
444
|
|
443
445
|
|
444
|
-
|
445
|
-
|
446
|
-
|
446
|
+
30
|
447
|
+
31
|
448
|
+
32</pre>
|
447
449
|
</td>
|
448
450
|
<td>
|
449
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
451
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 30</span>
|
450
452
|
|
451
453
|
<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>
|
452
454
|
<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_publish_on_apiary'>publish_on_apiary</span>
|
@@ -477,12 +479,12 @@
|
|
477
479
|
<pre class="lines">
|
478
480
|
|
479
481
|
|
480
|
-
|
481
|
-
|
482
|
-
|
482
|
+
53
|
483
|
+
54
|
484
|
+
55</pre>
|
483
485
|
</td>
|
484
486
|
<td>
|
485
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
487
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 53</span>
|
486
488
|
|
487
489
|
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
488
490
|
<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>
|
@@ -507,8 +509,6 @@
|
|
507
509
|
<pre class="lines">
|
508
510
|
|
509
511
|
|
510
|
-
32
|
511
|
-
33
|
512
512
|
34
|
513
513
|
35
|
514
514
|
36
|
@@ -518,10 +518,12 @@
|
|
518
518
|
40
|
519
519
|
41
|
520
520
|
42
|
521
|
-
43
|
521
|
+
43
|
522
|
+
44
|
523
|
+
45</pre>
|
522
524
|
</td>
|
523
525
|
<td>
|
524
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
526
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 34</span>
|
525
527
|
|
526
528
|
<span class='kw'>def</span> <span class='id identifier rubyid_publish_on_apiary'>publish_on_apiary</span>
|
527
529
|
<span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span>
|
@@ -555,8 +557,6 @@
|
|
555
557
|
<pre class="lines">
|
556
558
|
|
557
559
|
|
558
|
-
55
|
559
|
-
56
|
560
560
|
57
|
561
561
|
58
|
562
562
|
59
|
@@ -565,20 +565,40 @@
|
|
565
565
|
62
|
566
566
|
63
|
567
567
|
64
|
568
|
-
65
|
568
|
+
65
|
569
|
+
66
|
570
|
+
67
|
571
|
+
68
|
572
|
+
69
|
573
|
+
70
|
574
|
+
71
|
575
|
+
72
|
576
|
+
73
|
577
|
+
74
|
578
|
+
75
|
579
|
+
76</pre>
|
569
580
|
</td>
|
570
581
|
<td>
|
571
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
582
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 57</span>
|
572
583
|
|
573
584
|
<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>
|
574
585
|
<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/publish/</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>
|
575
586
|
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
576
587
|
<span class='symbol'>:code</span> <span class='op'>=></span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
577
588
|
<span class='rbrace'>}</span>
|
578
|
-
<span class='
|
579
|
-
|
580
|
-
<span class='kw'>
|
581
|
-
<span class='
|
589
|
+
<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>
|
590
|
+
|
591
|
+
<span class='kw'>begin</span>
|
592
|
+
<span class='const'>RestClient</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span> <span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span>
|
593
|
+
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>BadRequest</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
594
|
+
<span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
|
595
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parserError</span><span class='tstring_end'>'</span></span>
|
596
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parserError</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
597
|
+
<span class='kw'>else</span>
|
598
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apiary service responded with an error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_err'>err</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
599
|
+
<span class='kw'>end</span>
|
600
|
+
<span class='kw'>rescue</span> <span class='const'>RestClient</span><span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
601
|
+
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
|
582
602
|
<span class='kw'>end</span>
|
583
603
|
<span class='kw'>end</span></pre>
|
584
604
|
</td>
|
@@ -601,14 +621,14 @@
|
|
601
621
|
<pre class="lines">
|
602
622
|
|
603
623
|
|
604
|
-
45
|
605
|
-
46
|
606
624
|
47
|
607
625
|
48
|
608
|
-
49
|
626
|
+
49
|
627
|
+
50
|
628
|
+
51</pre>
|
609
629
|
</td>
|
610
630
|
<td>
|
611
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line
|
631
|
+
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 47</span>
|
612
632
|
|
613
633
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_apib_file'>validate_apib_file</span><span class='lparen'>(</span><span class='id identifier rubyid_apib_file'>apib_file</span><span class='rparen'>)</span>
|
614
634
|
<span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_apib_file'>apib_file</span><span class='rparen'>)</span>
|
@@ -625,7 +645,7 @@
|
|
625
645
|
</div>
|
626
646
|
|
627
647
|
<div id="footer">
|
628
|
-
Generated on
|
648
|
+
Generated on Thu Apr 17 13:30:52 2014 by
|
629
649
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
630
650
|
0.8.7.3 (ruby-2.1.0).
|
631
651
|
</div>
|