api_blueprint 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce8f3d792afe506423895b1f7a80c2b63810b82
|
4
|
+
data.tar.gz: 76925ee493aaaae50cd7779bc11db13b02ed11df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03addbc9798e412cc9190aa447065701ce85c46fd625ac93d2d066b749492098d21511153c211a3dbf6559ec2a77ac49270d53f42fe69729331763737c839b30
|
7
|
+
data.tar.gz: 540918ac22be65b4997a86bad3b03edc55867d84c5c411cec7d8ddb7be702369a04c843a0fc1911dcb7ce2aa762b71c6f9af277532d4ac191df1d89d882159ad
|
@@ -0,0 +1,387 @@
|
|
1
|
+
(function() { 'use strict';
|
2
|
+
$(function() {
|
3
|
+
var docTitle = $('title').text();
|
4
|
+
var addLinkToHistory = false;
|
5
|
+
|
6
|
+
/* init href position */
|
7
|
+
|
8
|
+
var href = window.location.href.split('#')[1];
|
9
|
+
if (href) {
|
10
|
+
var target = $('#' + href);
|
11
|
+
if (target.length == 0) {
|
12
|
+
href = href.replace(/^\d+\-/g, '');
|
13
|
+
target = $('#' + href);
|
14
|
+
}
|
15
|
+
|
16
|
+
if (target.length) {
|
17
|
+
$('html, body').scrollTop( target.offset().top - 20 );
|
18
|
+
|
19
|
+
$(window).load(function() {
|
20
|
+
$('html, body').scrollTop( target.offset().top - 20 );
|
21
|
+
|
22
|
+
var interval = null, i = 0;
|
23
|
+
|
24
|
+
interval = setInterval(function() {
|
25
|
+
$('html, body').scrollTop( target.offset().top - 20 );
|
26
|
+
++i;
|
27
|
+
|
28
|
+
if (i > 100) {
|
29
|
+
clearInterval(interval);
|
30
|
+
}
|
31
|
+
}, 10);
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
/* wrap contents */
|
37
|
+
|
38
|
+
var wrapFromTo = function(container, from, to) {
|
39
|
+
$(from).each(function() {
|
40
|
+
var starter = $(this);
|
41
|
+
var wrapper = $(container);
|
42
|
+
var content = starter.nextUntil(to);
|
43
|
+
|
44
|
+
starter.before(wrapper);
|
45
|
+
wrapper.append(starter);
|
46
|
+
wrapper.append(content);
|
47
|
+
});
|
48
|
+
};
|
49
|
+
|
50
|
+
wrapFromTo('<div class="toc">', "h1:contains('Table Of Contents')", 'h1');
|
51
|
+
wrapFromTo('<div class="resource">', "h1:contains('Resource: ')", 'h1, p.footer');
|
52
|
+
wrapFromTo('<div class="action">', ".resource > h2:contains('Action: ')", 'h2');
|
53
|
+
wrapFromTo('<div class="description">', ".action > h3:contains('Description:')", 'h3:contains("Examples")');
|
54
|
+
wrapFromTo('<div class="examples">', ".action > h3:contains('Examples:')", 'h3');
|
55
|
+
wrapFromTo('<div class="example">', ".examples > h4:contains('Example: ')", 'h4');
|
56
|
+
|
57
|
+
/* highlighting active toc */
|
58
|
+
|
59
|
+
var markTocActive = function() {
|
60
|
+
var pos = $(window).scrollTop() + 30;
|
61
|
+
|
62
|
+
var resources = $('h1');
|
63
|
+
var pickResource = resources[0]; // null;
|
64
|
+
resources.each(function() {
|
65
|
+
if ($(this).offset().top > pos) {
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
pickResource = this;
|
69
|
+
});
|
70
|
+
|
71
|
+
var tocLinks = $('.toc a');
|
72
|
+
tocLinks.removeClass('active');
|
73
|
+
|
74
|
+
var actions = $('h2');
|
75
|
+
var pickAction = null;
|
76
|
+
actions.each(function() {
|
77
|
+
if ($(this).offset().top > pos) {
|
78
|
+
return false;
|
79
|
+
}
|
80
|
+
pickAction = this;
|
81
|
+
});
|
82
|
+
|
83
|
+
if (pickAction) {
|
84
|
+
var id = $(pickAction).attr('id');
|
85
|
+
var tocActionLink = $('.toc a[href="#' + id + '"]');
|
86
|
+
|
87
|
+
tocActionLink.addClass('active');
|
88
|
+
}
|
89
|
+
|
90
|
+
if (pickResource) {
|
91
|
+
var id = $(pickResource).attr('id');
|
92
|
+
var tocLink = $('.toc a[href="#' + id + '"]');
|
93
|
+
|
94
|
+
var currentTocSection = tocLink.closest('li');
|
95
|
+
var otherSections = currentTocSection.siblings();
|
96
|
+
var activeChildren = currentTocSection.find('ul li a.active').length > 0;
|
97
|
+
|
98
|
+
tocLink.addClass('active');
|
99
|
+
tocLink.toggleClass('active-children',
|
100
|
+
activeChildren);
|
101
|
+
otherSections.find('a').removeClass('active');
|
102
|
+
|
103
|
+
currentTocSection.children('ul').slideDown();
|
104
|
+
otherSections.children('ul').slideUp();
|
105
|
+
|
106
|
+
if (history && history.replaceState) {
|
107
|
+
if (activeChildren) {
|
108
|
+
var newHash = tocActionLink.attr('href').split('#')[1];
|
109
|
+
var newTitle = tocActionLink.text() + ' - ' + tocLink.text() + ' - ' + docTitle;
|
110
|
+
} else {
|
111
|
+
var newHash = tocLink.attr('href').split('#')[1];
|
112
|
+
var newTitle = tocLink.text() + ' - ' + docTitle;
|
113
|
+
}
|
114
|
+
|
115
|
+
if (window.location.hash.split('#')[1] != newHash || document.title != newTitle) {
|
116
|
+
document.title = newTitle;
|
117
|
+
|
118
|
+
var newUrl = window.location.href.split('#')[0] + '#' + newHash;
|
119
|
+
var newData = { hash: newHash };
|
120
|
+
|
121
|
+
if (addLinkToHistory) {
|
122
|
+
history.pushState(newData, newTitle, newUrl);
|
123
|
+
|
124
|
+
addLinkToHistory = false;
|
125
|
+
} else {
|
126
|
+
history.replaceState(newData, newTitle, newUrl);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
};
|
132
|
+
|
133
|
+
$(window).scroll(markTocActive);
|
134
|
+
markTocActive();
|
135
|
+
|
136
|
+
/* scroll for toc links */
|
137
|
+
|
138
|
+
var scrollToTarget = function(target) {
|
139
|
+
if (target.length < 1) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
var position = target.offset().top;
|
144
|
+
|
145
|
+
$('html, body').scrollTop( position + 80 ).animate({
|
146
|
+
scrollTop: position - 20
|
147
|
+
});
|
148
|
+
};
|
149
|
+
|
150
|
+
var scrollToLinkTarget = function(link) {
|
151
|
+
addLinkToHistory = true;
|
152
|
+
|
153
|
+
var selector = link.attr('href');
|
154
|
+
var target = $(selector);
|
155
|
+
|
156
|
+
scrollToTarget(target);
|
157
|
+
|
158
|
+
return false;
|
159
|
+
};
|
160
|
+
|
161
|
+
window.onpopstate = function(event) {
|
162
|
+
var hash = event.state.hash;
|
163
|
+
if (!hash) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
|
167
|
+
var target = $('#' + hash);
|
168
|
+
setTimeout(function() {
|
169
|
+
scrollToTarget(target);
|
170
|
+
}, 0);
|
171
|
+
};
|
172
|
+
|
173
|
+
/* prettify code */
|
174
|
+
|
175
|
+
$('pre').addClass('prettyprint');
|
176
|
+
$('h5:contains("headers:") + pre').removeClass('prettyprint');
|
177
|
+
|
178
|
+
/* generate the curl requests */
|
179
|
+
|
180
|
+
var getHost = function() {
|
181
|
+
var host = $('#host');
|
182
|
+
|
183
|
+
if (host.length && host.text().substr(0, 4) === 'http') {
|
184
|
+
return host.text();
|
185
|
+
} else if (window.location.host.length) {
|
186
|
+
return window.location.protocol + '//' + window.location.host;
|
187
|
+
} else {
|
188
|
+
return 'http://www.example.com';
|
189
|
+
}
|
190
|
+
};
|
191
|
+
|
192
|
+
var generateCurlExample = function(exampleContent) {
|
193
|
+
if (exampleContent.find('.curl').length) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
|
197
|
+
var actionContent = exampleContent.closest('.action');
|
198
|
+
var method = actionContent.find('h4:contains("Signature:") + p > strong').text().toUpperCase();
|
199
|
+
if (method !== 'GET' && method !== 'POST' && method !== 'PATCH' && method !== 'DELETE') {
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
|
203
|
+
var path = actionContent.find('h4:contains("Signature:") + p > code').text();
|
204
|
+
if (path[0] !== '/') {
|
205
|
+
return;
|
206
|
+
}
|
207
|
+
|
208
|
+
var headers = exampleContent.find('h5:contains("Request headers:") + pre').text();
|
209
|
+
var params = exampleContent.find('h5:contains("Request params:") + pre').text();
|
210
|
+
var rawInfo = exampleContent.children('h5:contains("Request"), h5:contains("Request") + pre');
|
211
|
+
var prefix = ' ', suffix = ' \\\\\n', curl = '';
|
212
|
+
var multipart = !! headers.match(/multipart/);
|
213
|
+
|
214
|
+
var rawWrapper = $('<div class="raw"></div>');
|
215
|
+
exampleContent.children('h4').after(rawWrapper);
|
216
|
+
rawWrapper.append(rawInfo);
|
217
|
+
|
218
|
+
curl += 'curl --include' + suffix;
|
219
|
+
curl += prefix + '--request ' + method + suffix;
|
220
|
+
|
221
|
+
if (headers) {
|
222
|
+
headers.split("\n").forEach(function(header) {
|
223
|
+
if (header.length) {
|
224
|
+
curl += prefix + '--header "' + header.replace(/\s+/, ' ') + '"' + suffix;
|
225
|
+
}
|
226
|
+
});
|
227
|
+
}
|
228
|
+
|
229
|
+
if (params && method !== 'GET') {
|
230
|
+
if (multipart) {
|
231
|
+
$.each($.param($.parseJSON(params)).split("&"), function(index, param) {
|
232
|
+
var file = decodeURIComponent(param).match(/\S+\+\<(\S+?)\>/);
|
233
|
+
|
234
|
+
if (file) {
|
235
|
+
curl += prefix + '--form "' + decodeURIComponent(param).split('=')[0] + '=@' + file[1] + '"' + suffix;
|
236
|
+
} else {
|
237
|
+
curl += prefix + '--form "' + decodeURIComponent(param) + '"' + suffix;
|
238
|
+
}
|
239
|
+
});
|
240
|
+
} else {
|
241
|
+
curl += prefix + "--data-binary '" + params.replace(/\n+$/, '') + "'" + suffix;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
curl += prefix + '"' + getHost() + path;
|
246
|
+
if (params && method === 'GET') {
|
247
|
+
curl += '?' + $.param($.parseJSON(params)).replace(/&/g, '&');
|
248
|
+
}
|
249
|
+
curl += '"';
|
250
|
+
|
251
|
+
exampleContent.children('h4').after('<div class="curl"><h5>Request in cURL:</h5><pre><code>' + curl + '</code></pre></div>');
|
252
|
+
|
253
|
+
var controls = $("<span class='format-toggle'><a class='as-raw' href=''>Raw</a><a class='as-curl' href=''>cURL</a></span>");
|
254
|
+
exampleContent.find('> div h5:first-child').append(controls);
|
255
|
+
}
|
256
|
+
|
257
|
+
$(document).on('click', '.format-toggle a', function() {
|
258
|
+
$('html').toggleClass('example-curl', $(this).hasClass('as-curl'));
|
259
|
+
|
260
|
+
return false;
|
261
|
+
});
|
262
|
+
|
263
|
+
/* example unfolding */
|
264
|
+
|
265
|
+
$(document).on('click', '.example > h4', function() {
|
266
|
+
var thisExample = $(this).closest('.example');
|
267
|
+
|
268
|
+
$('.example').not(thisExample).removeClass('visible');
|
269
|
+
thisExample.toggleClass('visible');
|
270
|
+
|
271
|
+
if (thisExample.hasClass('visible')) {
|
272
|
+
generateCurlExample(thisExample);
|
273
|
+
|
274
|
+
$('html, body').animate({
|
275
|
+
scrollTop: thisExample.offset().top - 20
|
276
|
+
});
|
277
|
+
}
|
278
|
+
|
279
|
+
return false;
|
280
|
+
});
|
281
|
+
|
282
|
+
$('h5:contains("Response headers:") + pre').filter(function(item) {
|
283
|
+
var status = $(this).text().match(/Status\:\s*(\d+)/)[1];
|
284
|
+
|
285
|
+
return (status && parseInt(status) > 0 && parseInt(status) >= 400);
|
286
|
+
}).closest('.example').addClass('failed');
|
287
|
+
|
288
|
+
/* cut unnecessary texts */
|
289
|
+
|
290
|
+
$('.example > h4').each(function(header) {
|
291
|
+
$(this).text($(this).text().replace('Example: ', ''))
|
292
|
+
});
|
293
|
+
|
294
|
+
/* add example status descriptions */
|
295
|
+
|
296
|
+
$('.examples').append("<p class='example-description'>Examples that depict proper requests resulting in status 200 are marked with <em class='green'>green dots</em>, while those that depict wrong usage are marked with <em class='red'>red dots</em>.</p>")
|
297
|
+
|
298
|
+
/* add & handle the toc hider */
|
299
|
+
|
300
|
+
var tocHider = $('<a href="#" class="toc-hider"></a>');
|
301
|
+
var tocHeader = $('.toc h1');
|
302
|
+
tocHeader.after(tocHider);
|
303
|
+
tocHider.append(tocHeader);
|
304
|
+
|
305
|
+
tocHider.click(function() {
|
306
|
+
$('html').toggleClass('hide-toc');
|
307
|
+
|
308
|
+
return false;
|
309
|
+
});
|
310
|
+
|
311
|
+
/* mark js */
|
312
|
+
|
313
|
+
$('html').addClass('js');
|
314
|
+
|
315
|
+
/* handle param table */
|
316
|
+
|
317
|
+
$('h4:contains("Parameters:") + table').addClass('parameters');
|
318
|
+
|
319
|
+
$('table.parameters td:contains("[]")').each(function() {
|
320
|
+
var td = $(this),
|
321
|
+
level = td.text().match(/\[\]/g).length + 1,
|
322
|
+
row = td.closest('tr');
|
323
|
+
|
324
|
+
td.text(td.text().replace(/\[\]/g, ''));
|
325
|
+
row.addClass('param-level-' + level);
|
326
|
+
});
|
327
|
+
|
328
|
+
$('table.parameters code:contains("Example:")').addClass('example').each(function() {
|
329
|
+
$(this).text($(this).text().replace("Example:", ''));
|
330
|
+
});
|
331
|
+
|
332
|
+
$('table.parameters td:nth-child(2) strong:contains("required")').addClass("required");
|
333
|
+
|
334
|
+
/* Autolink */
|
335
|
+
|
336
|
+
$('a[href="#menu"]').addClass('menu-autolink');
|
337
|
+
|
338
|
+
$(document).on('click', 'a[href="#menu"]', function() {
|
339
|
+
var link = $(this);
|
340
|
+
var text = link.text();
|
341
|
+
var targetLink = $('.toc a:contains("' + text + '")');
|
342
|
+
|
343
|
+
if (targetLink.length) {
|
344
|
+
if (targetLink.length > 1) {
|
345
|
+
targetLink.each(function() {
|
346
|
+
var eachLink = $(this);
|
347
|
+
|
348
|
+
if (eachLink.text() == text) {
|
349
|
+
targetLink = eachLink;
|
350
|
+
return false;
|
351
|
+
}
|
352
|
+
});
|
353
|
+
}
|
354
|
+
|
355
|
+
link.attr('href', targetLink.attr('href'));
|
356
|
+
|
357
|
+
return scrollToLinkTarget(targetLink);
|
358
|
+
}
|
359
|
+
|
360
|
+
return false;
|
361
|
+
});
|
362
|
+
|
363
|
+
$('a[href="#example"]').addClass('example-autolink');
|
364
|
+
|
365
|
+
$(document).on('click', 'a[href="#example"]', function(e) {
|
366
|
+
var link = $(this);
|
367
|
+
var text = link.text();
|
368
|
+
var target = $('.example h4:contains("' + text + '")');
|
369
|
+
|
370
|
+
if (target.length) {
|
371
|
+
scrollToTarget(target);
|
372
|
+
|
373
|
+
if (! target.closest('.example').hasClass('visible')) {
|
374
|
+
target.click();
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
378
|
+
return false;
|
379
|
+
});
|
380
|
+
|
381
|
+
$(document).on('click', 'a[href^="#"]', function() {
|
382
|
+
return scrollToLinkTarget($(this));
|
383
|
+
});
|
384
|
+
});
|
385
|
+
})();
|
386
|
+
|
387
|
+
|
@@ -0,0 +1,172 @@
|
|
1
|
+
$lead: rgb(204, 17, 67);
|
2
|
+
$code: rgb(240, 230, 140);
|
3
|
+
$succ: rgb(152, 251, 152);
|
4
|
+
$fail: rgb(255, 160, 160);
|
5
|
+
|
6
|
+
$toc-width: 200px;
|
7
|
+
|
8
|
+
#title, #host, #copyright { display: none; }
|
9
|
+
|
10
|
+
html, body { background: #eee; font-family: Helvetica, "Trebuchet MS", Arial, sans-serif; padding: 0; margin: 0; font-size: 14px; }
|
11
|
+
code { font-family: "Lucida Console", Monaco, monospace; }
|
12
|
+
@media screen {
|
13
|
+
html.js body { padding-left: $toc-width; }
|
14
|
+
}
|
15
|
+
|
16
|
+
html.hide-toc {
|
17
|
+
body { padding-left: 0; }
|
18
|
+
.toc { bottom: auto; opacity: 0; border-bottom: 1px solid #ccc; box-shadow: 0px 0px 20px #888;
|
19
|
+
&:hover { opacity: 1; }
|
20
|
+
ul { display: none; }
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
a { text-decoration: none; color: $lead; }
|
25
|
+
a:hover { text-decoration: underline; }
|
26
|
+
h1, h2, h3, h4, h5 { font-weight: 300; margin: 20px; color: $lead; }
|
27
|
+
p { margin: 20px; }
|
28
|
+
p, li, td { line-height: 1.4em; }
|
29
|
+
pre { margin: 20px; padding: 5px; overflow-x: auto; background: #111 !important; color: $code; }
|
30
|
+
li { margin: 5px 0; }
|
31
|
+
ul ul { padding-left: 20px; }
|
32
|
+
|
33
|
+
table { text-align: left; width: 100%; border-spacing: 0; margin: 20px 0; margin-left: 10px;
|
34
|
+
p { margin: 0; }
|
35
|
+
span.param-level { display: none; }
|
36
|
+
td, th { padding: 8px 10px; vertical-align: top; }
|
37
|
+
th { font-size: 1em; font-weight: normal; color: #999; text-transform: uppercase; padding: 4px 10px; }
|
38
|
+
td { border-top: 1px solid #bbb; }
|
39
|
+
}
|
40
|
+
|
41
|
+
table.parameters {
|
42
|
+
tr.param-level-2 {
|
43
|
+
td { border-top-color: transparent; }
|
44
|
+
td:first-child { padding-left: 20px; }
|
45
|
+
}
|
46
|
+
tr.param-level-3 {
|
47
|
+
td { border-top-color: transparent; }
|
48
|
+
td:first-child { padding-left: 30px; }
|
49
|
+
}
|
50
|
+
tr.param-level-4 {
|
51
|
+
td { border-top-color: transparent; }
|
52
|
+
td:first-child { padding-left: 40px; }
|
53
|
+
}
|
54
|
+
code.example { display: block; word-wrap: break-word; color: #999; max-width: 120px; font-size: 0.9em; }
|
55
|
+
td:first-child { font-weight: bold; }
|
56
|
+
strong.required { color: $lead; display: block; }
|
57
|
+
}
|
58
|
+
|
59
|
+
a.menu-autolink, a.example-autolink {
|
60
|
+
&:before { margin-right: 1px; background: rgba($lead, 0); border-radius: 100px; text-decoration: none !important; width: 1.25em; display: inline-block; text-align: center; font-weight: bold; transition: 0.15s; }
|
61
|
+
&:hover:before { background: $lead; color: white; }
|
62
|
+
}
|
63
|
+
|
64
|
+
a.menu-autolink {
|
65
|
+
&:before { content: '☍'; }
|
66
|
+
}
|
67
|
+
|
68
|
+
a.example-autolink {
|
69
|
+
&:before { content: '✎'; }
|
70
|
+
}
|
71
|
+
|
72
|
+
@media screen {
|
73
|
+
blockquote { margin: 20px; background: #fff; overflow: hidden; border: 1px solid #ccc; box-shadow: 4px 0px 0px $lead inset;
|
74
|
+
p { margin: 10px 20px; }
|
75
|
+
}
|
76
|
+
|
77
|
+
.toc { position: fixed; left: 0; top: 0; bottom: 0; width: $toc-width; z-index: 10; overflow-y: auto; background: #f5f5f5; border-right: 1px solid #ccc; transition: opacity 0.3s; font-size: 0.9em;
|
78
|
+
h1 { font-size: 1.1em; }
|
79
|
+
ul li { margin: 0;
|
80
|
+
a { padding: 4px 10px; transition: 0.15s; line-height: 1.2em; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
|
81
|
+
&:hover { text-decoration: none; box-shadow: -2px 0px 0px 0px #bbb inset; }
|
82
|
+
&.active { color: #000; }
|
83
|
+
&.active:not(.active-children) { box-shadow: -2px 0px 0px 0px $lead inset; }
|
84
|
+
}
|
85
|
+
}
|
86
|
+
> ul { list-style-type: none; margin: 0; padding-left: 0;
|
87
|
+
> li {
|
88
|
+
> a { font-size: 1em; text-transform: uppercase; margin: 0; display: block; color: #999;
|
89
|
+
}
|
90
|
+
> ul { list-style-type: none; padding-left: 0; padding-bottom: 20px; padding-top: 0px; display: none;
|
91
|
+
> li > a { font-size: 1.0em; display: block; padding-left: 20px; color: #888;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
@media print {
|
100
|
+
html, body { height: 100%; }
|
101
|
+
|
102
|
+
#title, #copyright { display: block; }
|
103
|
+
#title { font-size: 2em; color: $lead; padding-top: 50%; margin-top: 60px; }
|
104
|
+
#copyright { page-break-after: always; }
|
105
|
+
|
106
|
+
p.footer.copyright { display: none; }
|
107
|
+
|
108
|
+
h1 { page-break-before: always; }
|
109
|
+
.toc h1 { page-break-before: auto; }
|
110
|
+
.examples {
|
111
|
+
.example-description { display: none; }
|
112
|
+
.example { display: none; }
|
113
|
+
.example:nth-child(2) { display: block; }
|
114
|
+
|
115
|
+
&:after { content: 'Refer to online documentation for more examples on this action\'s usage.'; display: block; margin: 20px; font-weight: 300; }
|
116
|
+
}
|
117
|
+
table { padding: 0 20px; }
|
118
|
+
}
|
119
|
+
|
120
|
+
@media screen {
|
121
|
+
.resource { clear: both; position: relative; z-index: 1;
|
122
|
+
.action { clear: both; border-bottom: 1px solid #ccc; overflow: hidden;
|
123
|
+
h3 { text-transform: uppercase; }
|
124
|
+
|
125
|
+
.description { float: left; width: 50%; background: #fff; border-top: 1px solid #ccc; position: relative;
|
126
|
+
blockquote { background: #eee; }
|
127
|
+
}
|
128
|
+
.examples { float: right; width: 50%; color: #fff; background: #333; border-top: 1px solid #ccc; position: relative;
|
129
|
+
.example-description { color: #888; font-style: italic; margin-top: 15px; margin-bottom: 15px;
|
130
|
+
em { color: #aaa; white-space: nowrap; font-style: normal; }
|
131
|
+
em:before { content: ' '; display: inline-block; height: 10px; width: 10px; border-radius: 5px; margin-right: 3px; background: $succ; }
|
132
|
+
em.red:before { background: $fail; }
|
133
|
+
}
|
134
|
+
h3 { color: #eee; margin-bottom: 13px; }
|
135
|
+
h5 { color: #888; text-transform: uppercase; }
|
136
|
+
.example.visible {
|
137
|
+
> * { display: block; }
|
138
|
+
}
|
139
|
+
.example {
|
140
|
+
> * { display: none; margin: 20px; }
|
141
|
+
> h4 { display: block; cursor: pointer; color: #ddd; font-size: 1em; padding: 7px 20px 7px 40px; position: relative; margin: 0; transition: 0.15s; }
|
142
|
+
> h4:before { position: absolute; top: 50%; margin-top: -5px; left: 20px; height: 10px; width: 10px; border-radius: 5px; background: $succ; display: block; content: ' '; }
|
143
|
+
> h4:hover { color: #fff; background: #4c4c4c; }
|
144
|
+
> .curl, > .raw { margin: 0; }
|
145
|
+
> .curl { display: none; }
|
146
|
+
}
|
147
|
+
|
148
|
+
.example.failed > h4:before { background: $fail; }
|
149
|
+
}
|
150
|
+
|
151
|
+
.description:after, .examples:after { position: absolute; top: 100%; height: 10000px; left: 0; right: 0; background: #fff; content: ' '; }
|
152
|
+
.examples:after { background: #333; }
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
.format-toggle { float: right;
|
158
|
+
a { color: #888; margin-left: 5px; }
|
159
|
+
.as-raw { color: #bbb; }
|
160
|
+
}
|
161
|
+
|
162
|
+
html.example-curl .resource .action .examples .example.visible {
|
163
|
+
> .curl { display: block; }
|
164
|
+
> .raw { display: none; }
|
165
|
+
.format-toggle {
|
166
|
+
.as-raw { color: #888; }
|
167
|
+
.as-curl { color: #bbb; }
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
p.footer { text-align: center; color: #888; clear: both; }
|
172
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Visuality API</title>
|
6
|
+
|
7
|
+
<meta charset="utf-8">
|
8
|
+
|
9
|
+
<style id="blueprint-style"></style>
|
10
|
+
|
11
|
+
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
|
12
|
+
<script id="blueprint-script"></script>
|
13
|
+
<script type="text/javascript" src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=desert"></script>
|
14
|
+
</head>
|
15
|
+
|
16
|
+
<body>
|
17
|
+
<div id="blueprint-document">
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<p class='footer copyright'>© Visuality</p>
|
21
|
+
</body>
|
22
|
+
</html>
|
23
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_blueprint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karol Słuszniak
|
@@ -80,12 +80,8 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
84
|
-
|
85
|
-
way you need using Markdown syntax. You can organize documentation files into partials.
|
86
|
-
Upon any API change, like serializer change that changes responses, you can update
|
87
|
-
automatically generated parts of docs. Once done, you can compile your documentation
|
88
|
-
into single, nicely styled HTML file. You can also auto-deploy it via SSH.
|
83
|
+
description: Semi-automatic solution for creating Rails app's API documentation based
|
84
|
+
on RSpec request specs.
|
89
85
|
email: k.sluszniak@visuality.pl
|
90
86
|
executables: []
|
91
87
|
extensions: []
|
@@ -100,6 +96,9 @@ files:
|
|
100
96
|
- lib/api_blueprint/collect/renderer.rb
|
101
97
|
- lib/api_blueprint/collect/spec_hook.rb
|
102
98
|
- lib/api_blueprint/collect/storage.rb
|
99
|
+
- lib/api_blueprint/compile/assets/blueprint.js
|
100
|
+
- lib/api_blueprint/compile/assets/blueprint.scss
|
101
|
+
- lib/api_blueprint/compile/assets/index.html
|
103
102
|
- lib/api_blueprint/compile/compile.rb
|
104
103
|
- lib/api_blueprint/compile/storage.rb
|
105
104
|
- lib/api_blueprint/railtie.rb
|