apiaryio 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +34 -12
- data/.travis.yml +1 -0
- data/Rakefile +8 -0
- data/apiary.gemspec +5 -2
- data/circle.yml +4 -0
- data/features/fetch.feature +7 -0
- data/features/fixtures/apiary.apib +48 -0
- data/features/preview.feature +7 -0
- data/features/publish.feature +7 -0
- data/features/step_definitions/file_content_step.rb +19 -0
- data/features/support/env.rb +7 -0
- data/features/support/setup.rb +1 -0
- data/features/version.feature +10 -0
- data/lib/apiary/cli.rb +37 -74
- data/lib/apiary/command/fetch.rb +2 -2
- data/lib/apiary/command/preview.rb +16 -5
- data/lib/apiary/command/publish.rb +3 -2
- data/lib/apiary/version.rb +1 -1
- data/spec/cli_spec.rb +1 -1
- data/spec/command/fetch_spec.rb +11 -9
- data/spec/spec_helper.rb +7 -0
- data/spec/support/aruba.rb +11 -0
- metadata +108 -52
- checksums.yaml +0 -7
- data/doc/Apiary.html +0 -131
- data/doc/Apiary/CLI.html +0 -528
- data/doc/Apiary/Command.html +0 -117
- data/doc/Apiary/Command/Fetch.html +0 -652
- data/doc/Apiary/Command/Help.html +0 -338
- data/doc/Apiary/Command/Preview.html +0 -1089
- data/doc/Apiary/Command/Publish.html +0 -658
- data/doc/Apiary/Command/Runner.html +0 -200
- data/doc/Apiary/Command/Version.html +0 -200
- data/doc/_index.html +0 -214
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/file.README.html +0 -169
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -169
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -281
- data/doc/top-level-namespace.html +0 -112
- data/lib/apiary/command/help.rb +0 -38
- data/lib/apiary/command/runner.rb +0 -13
- data/lib/apiary/command/version.rb +0 -13
@@ -1,658 +0,0 @@
|
|
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::Publish
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.4
|
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#!Apiary/Command/Publish.html";
|
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 (P)</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">Publish</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::Publish
|
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::Publish</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/publish.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>Display preview of local blueprint file</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="#initialize-instance_method" title="#initialize (instance method)">- (Publish) <strong>initialize</strong>(opts) </a>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
</span>
|
201
|
-
|
202
|
-
|
203
|
-
<span class="note title constructor">constructor</span>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<span class="summary_desc"><div class='inline'>
|
213
|
-
<p>TODO: use OpenStruct to store @options.</p>
|
214
|
-
</div></span>
|
215
|
-
|
216
|
-
</li>
|
217
|
-
|
218
|
-
|
219
|
-
<li class="public ">
|
220
|
-
<span class="summary_signature">
|
221
|
-
|
222
|
-
<a href="#path-instance_method" title="#path (instance method)">- (Object) <strong>path</strong> </a>
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
</span>
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
237
|
-
|
238
|
-
</li>
|
239
|
-
|
240
|
-
|
241
|
-
<li class="public ">
|
242
|
-
<span class="summary_signature">
|
243
|
-
|
244
|
-
<a href="#publish_on_apiary-instance_method" title="#publish_on_apiary (instance method)">- (Object) <strong>publish_on_apiary</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
|
-
<li class="public ">
|
286
|
-
<span class="summary_signature">
|
287
|
-
|
288
|
-
<a href="#validate_apib_file-instance_method" title="#validate_apib_file (instance method)">- (Object) <strong>validate_apib_file</strong>(apib_file) </a>
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
</span>
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
303
|
-
|
304
|
-
</li>
|
305
|
-
|
306
|
-
|
307
|
-
</ul>
|
308
|
-
|
309
|
-
|
310
|
-
<div id="constructor_details" class="method_details_list">
|
311
|
-
<h2>Constructor Details</h2>
|
312
|
-
|
313
|
-
<div class="method_details first">
|
314
|
-
<h3 class="signature first" id="initialize-instance_method">
|
315
|
-
|
316
|
-
- (<tt><span class='object_link'><a href="" title="Apiary::Command::Publish (class)">Publish</a></span></tt>) <strong>initialize</strong>(opts)
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
</h3><div class="docstring">
|
323
|
-
<div class="discussion">
|
324
|
-
|
325
|
-
<p>TODO: use OpenStruct to store @options</p>
|
326
|
-
|
327
|
-
|
328
|
-
</div>
|
329
|
-
</div>
|
330
|
-
<div class="tags">
|
331
|
-
|
332
|
-
|
333
|
-
</div><table class="source_code">
|
334
|
-
<tr>
|
335
|
-
<td>
|
336
|
-
<pre class="lines">
|
337
|
-
|
338
|
-
|
339
|
-
15
|
340
|
-
16
|
341
|
-
17
|
342
|
-
18
|
343
|
-
19
|
344
|
-
20
|
345
|
-
21
|
346
|
-
22
|
347
|
-
23
|
348
|
-
24
|
349
|
-
25
|
350
|
-
26
|
351
|
-
27
|
352
|
-
28
|
353
|
-
29</pre>
|
354
|
-
</td>
|
355
|
-
<td>
|
356
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 15</span>
|
357
|
-
|
358
|
-
<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>
|
359
|
-
<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
|
-
<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>
|
361
|
-
<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>
|
362
|
-
<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>
|
363
|
-
<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>
|
364
|
-
<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>
|
365
|
-
<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>
|
366
|
-
<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>
|
367
|
-
<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>
|
368
|
-
<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>
|
369
|
-
<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>
|
370
|
-
<span class='rbrace'>}</span>
|
371
|
-
<span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_commit_message'>commit_message</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Saving blueprint from apiary-client</span><span class='tstring_end'>"</span></span>
|
372
|
-
<span class='kw'>end</span></pre>
|
373
|
-
</td>
|
374
|
-
</tr>
|
375
|
-
</table>
|
376
|
-
</div>
|
377
|
-
|
378
|
-
</div>
|
379
|
-
|
380
|
-
<div id="instance_attr_details" class="attr_details">
|
381
|
-
<h2>Instance Attribute Details</h2>
|
382
|
-
|
383
|
-
|
384
|
-
<span id=""></span>
|
385
|
-
<div class="method_details first">
|
386
|
-
<h3 class="signature first" id="options-instance_method">
|
387
|
-
|
388
|
-
- (<tt>Object</tt>) <strong>options</strong> <span class="extras">(readonly)</span>
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
</h3><div class="docstring">
|
395
|
-
<div class="discussion">
|
396
|
-
|
397
|
-
<p>Returns the value of attribute options</p>
|
398
|
-
|
399
|
-
|
400
|
-
</div>
|
401
|
-
</div>
|
402
|
-
<div class="tags">
|
403
|
-
|
404
|
-
|
405
|
-
</div><table class="source_code">
|
406
|
-
<tr>
|
407
|
-
<td>
|
408
|
-
<pre class="lines">
|
409
|
-
|
410
|
-
|
411
|
-
12
|
412
|
-
13
|
413
|
-
14</pre>
|
414
|
-
</td>
|
415
|
-
<td>
|
416
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 12</span>
|
417
|
-
|
418
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
419
|
-
<span class='ivar'>@options</span>
|
420
|
-
<span class='kw'>end</span></pre>
|
421
|
-
</td>
|
422
|
-
</tr>
|
423
|
-
</table>
|
424
|
-
</div>
|
425
|
-
|
426
|
-
</div>
|
427
|
-
|
428
|
-
|
429
|
-
<div id="class_method_details" class="method_details_list">
|
430
|
-
<h2>Class Method Details</h2>
|
431
|
-
|
432
|
-
|
433
|
-
<div class="method_details first">
|
434
|
-
<h3 class="signature first" id="execute-class_method">
|
435
|
-
|
436
|
-
+ (<tt>Object</tt>) <strong>execute</strong>(args)
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
</h3><table class="source_code">
|
443
|
-
<tr>
|
444
|
-
<td>
|
445
|
-
<pre class="lines">
|
446
|
-
|
447
|
-
|
448
|
-
31
|
449
|
-
32
|
450
|
-
33</pre>
|
451
|
-
</td>
|
452
|
-
<td>
|
453
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 31</span>
|
454
|
-
|
455
|
-
<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>
|
456
|
-
<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>
|
457
|
-
<span class='kw'>end</span></pre>
|
458
|
-
</td>
|
459
|
-
</tr>
|
460
|
-
</table>
|
461
|
-
</div>
|
462
|
-
|
463
|
-
</div>
|
464
|
-
|
465
|
-
<div id="instance_method_details" class="method_details_list">
|
466
|
-
<h2>Instance Method Details</h2>
|
467
|
-
|
468
|
-
|
469
|
-
<div class="method_details first">
|
470
|
-
<h3 class="signature first" id="path-instance_method">
|
471
|
-
|
472
|
-
- (<tt>Object</tt>) <strong>path</strong>
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
</h3><table class="source_code">
|
479
|
-
<tr>
|
480
|
-
<td>
|
481
|
-
<pre class="lines">
|
482
|
-
|
483
|
-
|
484
|
-
54
|
485
|
-
55
|
486
|
-
56</pre>
|
487
|
-
</td>
|
488
|
-
<td>
|
489
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 54</span>
|
490
|
-
|
491
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
492
|
-
<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>
|
493
|
-
<span class='kw'>end</span></pre>
|
494
|
-
</td>
|
495
|
-
</tr>
|
496
|
-
</table>
|
497
|
-
</div>
|
498
|
-
|
499
|
-
<div class="method_details ">
|
500
|
-
<h3 class="signature " id="publish_on_apiary-instance_method">
|
501
|
-
|
502
|
-
- (<tt>Object</tt>) <strong>publish_on_apiary</strong>
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
</h3><table class="source_code">
|
509
|
-
<tr>
|
510
|
-
<td>
|
511
|
-
<pre class="lines">
|
512
|
-
|
513
|
-
|
514
|
-
35
|
515
|
-
36
|
516
|
-
37
|
517
|
-
38
|
518
|
-
39
|
519
|
-
40
|
520
|
-
41
|
521
|
-
42
|
522
|
-
43
|
523
|
-
44
|
524
|
-
45
|
525
|
-
46</pre>
|
526
|
-
</td>
|
527
|
-
<td>
|
528
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 35</span>
|
529
|
-
|
530
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_publish_on_apiary'>publish_on_apiary</span>
|
531
|
-
<span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_name'>api_name</span>
|
532
|
-
<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>
|
533
|
-
<span class='kw'>end</span>
|
534
|
-
|
535
|
-
<span class='kw'>unless</span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_api_key'>api_key</span>
|
536
|
-
<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>
|
537
|
-
<span class='kw'>end</span>
|
538
|
-
|
539
|
-
<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>
|
540
|
-
|
541
|
-
<span class='kw'>end</span></pre>
|
542
|
-
</td>
|
543
|
-
</tr>
|
544
|
-
</table>
|
545
|
-
</div>
|
546
|
-
|
547
|
-
<div class="method_details ">
|
548
|
-
<h3 class="signature " id="query_apiary-instance_method">
|
549
|
-
|
550
|
-
- (<tt>Object</tt>) <strong>query_apiary</strong>(host, path)
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
</h3><table class="source_code">
|
557
|
-
<tr>
|
558
|
-
<td>
|
559
|
-
<pre class="lines">
|
560
|
-
|
561
|
-
|
562
|
-
58
|
563
|
-
59
|
564
|
-
60
|
565
|
-
61
|
566
|
-
62
|
567
|
-
63
|
568
|
-
64
|
569
|
-
65
|
570
|
-
66
|
571
|
-
67
|
572
|
-
68
|
573
|
-
69
|
574
|
-
70
|
575
|
-
71
|
576
|
-
72
|
577
|
-
73
|
578
|
-
74
|
579
|
-
75
|
580
|
-
76
|
581
|
-
77
|
582
|
-
78</pre>
|
583
|
-
</td>
|
584
|
-
<td>
|
585
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 58</span>
|
586
|
-
|
587
|
-
<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>
|
588
|
-
<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>
|
589
|
-
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
590
|
-
<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><span class='comma'>,</span>
|
591
|
-
<span class='symbol'>:messageToSave</span> <span class='op'>=></span> <span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_commit_message'>commit_message</span>
|
592
|
-
<span class='rbrace'>}</span>
|
593
|
-
<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>
|
594
|
-
|
595
|
-
<span class='kw'>begin</span>
|
596
|
-
<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>
|
597
|
-
<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>
|
598
|
-
<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>
|
599
|
-
<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>
|
600
|
-
<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>
|
601
|
-
<span class='kw'>else</span>
|
602
|
-
<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>
|
603
|
-
<span class='kw'>end</span>
|
604
|
-
<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>
|
605
|
-
<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>
|
606
|
-
<span class='kw'>end</span>
|
607
|
-
<span class='kw'>end</span></pre>
|
608
|
-
</td>
|
609
|
-
</tr>
|
610
|
-
</table>
|
611
|
-
</div>
|
612
|
-
|
613
|
-
<div class="method_details ">
|
614
|
-
<h3 class="signature " id="validate_apib_file-instance_method">
|
615
|
-
|
616
|
-
- (<tt>Object</tt>) <strong>validate_apib_file</strong>(apib_file)
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
</h3><table class="source_code">
|
623
|
-
<tr>
|
624
|
-
<td>
|
625
|
-
<pre class="lines">
|
626
|
-
|
627
|
-
|
628
|
-
48
|
629
|
-
49
|
630
|
-
50
|
631
|
-
51
|
632
|
-
52</pre>
|
633
|
-
</td>
|
634
|
-
<td>
|
635
|
-
<pre class="code"><span class="info file"># File 'lib/apiary/command/publish.rb', line 48</span>
|
636
|
-
|
637
|
-
<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>
|
638
|
-
<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>
|
639
|
-
<span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apiary definition file hasn't been found: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_apib_file'>apib_file</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
640
|
-
<span class='kw'>end</span>
|
641
|
-
<span class='kw'>end</span></pre>
|
642
|
-
</td>
|
643
|
-
</tr>
|
644
|
-
</table>
|
645
|
-
</div>
|
646
|
-
|
647
|
-
</div>
|
648
|
-
|
649
|
-
</div>
|
650
|
-
|
651
|
-
<div id="footer">
|
652
|
-
Generated on Mon May 12 13:32:43 2014 by
|
653
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
654
|
-
0.8.7.4 (ruby-2.0.0).
|
655
|
-
</div>
|
656
|
-
|
657
|
-
</body>
|
658
|
-
</html>
|