buttless 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,230 @@
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title>My Funky API Documentation</title>
5
+ <base href="file://localhost/Users/tobin/Sandbox/buttless/lib/template/api-doc/">
6
+ <link href="report.css" media="screen, print" rel="stylesheet" type="text/css" />
7
+ <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
8
+ </head>
9
+ <body>
10
+ <img src="images/logo.png" alt="Logo" style="float: right; width: 150px;"/>
11
+ <span class="title">Funky API<br/><small>Version 1.0</small></span>
12
+ <p>Document v0.1 DRAFT - Mar 25, 2012 17:40</p>
13
+ <p class="big-heading">This document describes my Funky API. It's automatically generated by Buttless. </p>
14
+
15
+ <h1>About the API</h1>
16
+
17
+ <p>Describe the context of your API. What is it for? What can the user learn in this document?</p>
18
+
19
+ <p>What does this do for it&#39;s users? Who are the users? Using the API, it
20
+ becomes possible to:</p>
21
+
22
+ <ul>
23
+ <li> Do something 1</li>
24
+ <li> Do something 2</li>
25
+ <li> Do something 3</li>
26
+ <li> Do something 4</li>
27
+ </ul>
28
+
29
+ <h2>Supported Languages</h2>
30
+
31
+ <p>The API accepts HTTP GET and POST requests. This makes it possible to
32
+ control the API using a wide variety of languages and frameworks with
33
+ very little effort. To name a few, you can control the API using any of
34
+ the following:</p>
35
+
36
+ <ul>
37
+ <li> Javascript or jQuery</li>
38
+ <li> Java</li>
39
+ <li> Microsoft .NET</li>
40
+ <li> Ruby</li>
41
+ <li> Python</li>
42
+ <li> Objective-C</li>
43
+ </ul>
44
+
45
+ <h2>Getting Help</h2>
46
+
47
+ <p>Help is always available when working with the API. You can search the forum at FORUM.</p>
48
+
49
+ <h1>Quick Start</h1>
50
+
51
+ <p>Describe how someone can get started quickly with the API:</p>
52
+
53
+ <pre><code>Using Ruby
54
+ require &#39;restclient&#39;
55
+ json = RESTClient.get(&quot;http://192.168.1.3/api/funky/stuff&quot;)
56
+
57
+ Using CURL
58
+ curl &quot;http://192.168.1.3/api/funky/stuff&quot;
59
+ </code></pre>
60
+
61
+ <p>These would return
62
+ <pre>
63
+ [
64
+ {&quot;id&quot;: 1, &quot;name&quot;: &quot;Funky 1&quot;},
65
+ {&quot;id&quot;: 2, &quot;name&quot;: &quot;Funky 2&quot;}
66
+ ]</pre> </p>
67
+
68
+ <h1>API Documentation</h1>
69
+
70
+ <h2>Overview</h2>
71
+
72
+ <table class="api">
73
+ <tr>
74
+ <td>GET</td>
75
+ <td>/api/funky/thing</td>
76
+ <td>Returns information about the thing.
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ <td>GET</td>
81
+ <td>/api/funky/stuff</td>
82
+ <td>Returns a list of stuff.
83
+ </td>
84
+ </tr>
85
+ <tr>
86
+ <td>GET</td>
87
+ <td>/api/funky/stuff/:id/info</td>
88
+ <td>Returns the info about the stuff.
89
+ </td>
90
+ </tr>
91
+ <tr>
92
+ <td>POST</td>
93
+ <td>/api/funky/stuff/:id/info</td>
94
+ <td>Updates stuff.
95
+ </td>
96
+ </tr>
97
+ </table>
98
+
99
+ <h2>Global API&#39;s</h2>
100
+
101
+ <h2>Funky Thing</h2>
102
+
103
+ <h3>GET /api/funky/thing <small style='color: #AAA'></small></h3>
104
+
105
+ <p>Returns information about the thing. </p>
106
+
107
+ <h4>Example request:</h4>
108
+
109
+ <pre>
110
+ curl -v http://192.168.1.3/api/funky/thing</pre>
111
+
112
+ <p>This API resolves to <code>/api/funky/thing/info.json</code>.</p>
113
+
114
+ <h4>Example response:</h4>
115
+
116
+ <pre>
117
+ {"id": 2, "name": "Funky Thing"}</pre>
118
+
119
+ <h4>Using this API</h4>
120
+
121
+ <h2>Funky Stuff</h2>
122
+
123
+ <h3>GET /api/funky/stuff <small style='color: #AAA'></small></h3>
124
+
125
+ <p>Returns a list of stuff.</p>
126
+
127
+ <h4>Example request:</h4>
128
+
129
+ <pre>
130
+ curl -v http://192.168.1.3/api/funky/stuff</pre>
131
+
132
+ <p>This API resolves to <code>/api/funky/stuff/index.json</code>.</p>
133
+
134
+ <h4>Example response:</h4>
135
+
136
+ <pre>
137
+ [
138
+ {"id": 1, "name": "Funky 1"},
139
+ {"id": 2, "name": "Funky 2"}
140
+ ]</pre>
141
+
142
+ <h4>Using this API</h4>
143
+
144
+ <p>This method is very useful.</p>
145
+
146
+ <h3>GET /api/funky/stuff/:id/info <small style='color: #AAA'></small></h3>
147
+
148
+ <p>Returns the info about the stuff.</p>
149
+
150
+ <h4>Paramters</h4>
151
+
152
+ <table class="parameters">
153
+ <tr>
154
+ <th>Name</th>
155
+ <th>Example</th>
156
+ <th>Description</th>
157
+ <th>Optional</th>
158
+ </tr>
159
+
160
+ <tr>
161
+ <td>id</td>
162
+ <td>1</td>
163
+ <td>The id of the stuff</td>
164
+ <td></td>
165
+ </tr>
166
+ </table>
167
+
168
+ <h4>Example request:</h4>
169
+
170
+ <pre>
171
+ curl -v http://192.168.1.3/api/funky/stuff/1/info</pre>
172
+
173
+ <p>This API resolves to <code>/api/funky/stuff/:id/info.json</code>.</p>
174
+
175
+ <h4>Example response:</h4>
176
+
177
+ <pre>
178
+ {"id": 2, "name": "Funky 2", "description": "This is funky"}</pre>
179
+
180
+ <h4>Using this API</h4>
181
+
182
+ <h3>POST /api/funky/stuff/:id/info <small style='color: #AAA'></small></h3>
183
+
184
+ <p>Updates stuff.</p>
185
+
186
+ <h4>Paramters</h4>
187
+
188
+ <table class="parameters">
189
+ <tr>
190
+ <th>Name</th>
191
+ <th>Example</th>
192
+ <th>Description</th>
193
+ <th>Optional</th>
194
+ </tr>
195
+
196
+ <tr>
197
+ <td>id</td>
198
+ <td>1</td>
199
+ <td>The id of the device</td>
200
+ <td></td>
201
+ </tr>
202
+ <tr>
203
+ <td>name</td>
204
+ <td>My Stuff</td>
205
+ <td>The new name of the stuff</td>
206
+ <td></td>
207
+ </tr>
208
+ </table>
209
+
210
+ <h4>Example request:</h4>
211
+
212
+ <pre>
213
+ curl -v \
214
+ --data "name=My Stuff" \
215
+ http://192.168.1.3/api/funky/stuff/1/info</pre>
216
+
217
+ <p>This API resolves to <code>/api/funky/stuff/:id/info.json</code>.</p>
218
+
219
+ <h4>Example response:</h4>
220
+
221
+ <pre>
222
+ {
223
+ "result": "ok"
224
+ }</pre>
225
+
226
+ <h4>Using this API</h4>
227
+
228
+ <h2>Glossary</h2>
229
+
230
+ </body>
@@ -0,0 +1,125 @@
1
+
2
+ About the API
3
+ =============
4
+
5
+ Describe the context of your API. What is it for? What can the user learn in this document?
6
+
7
+ What does this do for it's users? Who are the users? Using the API, it
8
+ becomes possible to:
9
+
10
+ - Do something 1
11
+ - Do something 2
12
+ - Do something 3
13
+ - Do something 4
14
+
15
+ ## Supported Languages
16
+
17
+
18
+ The API accepts HTTP GET and POST requests. This makes it possible to
19
+ control the API using a wide variety of languages and frameworks with
20
+ very little effort. To name a few, you can control the API using any of
21
+ the following:
22
+
23
+ - Javascript or jQuery
24
+ - Java
25
+ - Microsoft .NET
26
+ - Ruby
27
+ - Python
28
+ - Objective-C
29
+
30
+ ## Getting Help
31
+
32
+ Help is always available when working with the API. You can search the forum at FORUM.
33
+
34
+ Quick Start
35
+ ===========
36
+
37
+ Describe how someone can get started quickly with the API:
38
+
39
+ Using Ruby
40
+ require 'restclient'
41
+ json = RESTClient.get("http://192.168.1.3/api/funky/stuff")
42
+
43
+ Using CURL
44
+ curl "http://192.168.1.3/api/funky/stuff"
45
+
46
+ These would return
47
+ <pre>
48
+ <%= example :funky_stuff %>
49
+ </pre>
50
+
51
+ API Documentation
52
+ =================
53
+
54
+ ## Overview
55
+ <table class="api">
56
+ <% @db.each do |res| %>
57
+ <% res["methods"].each do |method| %>
58
+ <tr>
59
+ <td><%= method["method"] %></td>
60
+ <td><%= method["path"] %></td>
61
+ <td><%= method["precis"] %></td>
62
+ </tr>
63
+ <% end %>
64
+ <% end %>
65
+ </table>
66
+
67
+ ## Global API's
68
+
69
+ <% @db.each do |res| %>
70
+ ## <%= res["resource"] %>
71
+
72
+ <% res["methods"].each do |method| %>
73
+ ### <%= method["method"] %> <%= method["path"] %> <small style='color: #AAA'><%= method["path_comment"] %></small> <%= method["path"].length > 100 ? "<br/><span style='color:red'>WARNING: API too long at #{method["path"].length}!</span>" : "" %>
74
+
75
+ <%= method["precis"] %>
76
+
77
+ <% if method["parameters"] %>
78
+ #### Paramters
79
+
80
+ <table class="parameters">
81
+ <tr>
82
+ <th>Name</th>
83
+ <th>Example</th>
84
+ <th>Description</th>
85
+ <th>Optional</th>
86
+ </tr>
87
+
88
+ <% method["parameters"].each do |param|%>
89
+ <tr>
90
+ <td><%= param["name"]%></td>
91
+ <td><%= param["example"]%></td>
92
+ <td><%= param["precis"]%></td>
93
+ <td></td>
94
+ </tr>
95
+ <% end %>
96
+ </table>
97
+ <% end %>
98
+
99
+ #### Example request:
100
+
101
+ <pre>
102
+ <%= helper.example_curl(method)%>
103
+ </pre>
104
+
105
+ <% if method["resolves_to"] %>
106
+ This API resolves to <code><%= method["resolves_to"]%></code>.
107
+ <% end %>
108
+
109
+ #### Example response:
110
+
111
+ <pre>
112
+ <%= example method["example_response"] %>
113
+ </pre>
114
+
115
+ #### Using this API
116
+
117
+ <%= method["description"] %>
118
+
119
+ <% end %>
120
+ <% end %>
121
+
122
+
123
+ ## Glossary
124
+
125
+
@@ -0,0 +1,152 @@
1
+
2
+ body{
3
+ font-family: Helvetica;
4
+ font-size: 0.8em;
5
+ line-height: 1.6em;
6
+
7
+ }
8
+
9
+ .title {
10
+ font-size: 2.8em;
11
+ font-weight: bold;
12
+ line-height: 1.2em;
13
+ font-family: Helvetica;
14
+ }
15
+
16
+ h1 {
17
+ font-size: 2.2em;
18
+ font-weight: bold;
19
+ line-height: 1.2em;
20
+ font-family: Helvetica;
21
+ page-break-before: always;
22
+ }
23
+
24
+ .title small{
25
+ font-size: 0.6em;
26
+
27
+ }
28
+
29
+ h2, h3, h4{
30
+ font-weight: bold;
31
+ color: #222;
32
+ font-size: 1.8em;
33
+ font-family: Helvetica;
34
+ }
35
+
36
+ h2{
37
+ font-size: 1.8em;
38
+ }
39
+
40
+ h3{
41
+ font-size: 1.2em;
42
+ font-style: normal;
43
+ color: #900;
44
+ padding-bottom: 1em;
45
+ border-bottom: 1px solid #900;
46
+ }
47
+
48
+ h4{
49
+ font-size: 1.0em;
50
+ }
51
+
52
+ .note{
53
+ font-size: 0.8em;
54
+ padding: 1em;
55
+ background: #EEE;
56
+ }
57
+
58
+ .big-heading{
59
+ background: #222;
60
+ font-size: 1.4em;
61
+ line-height: 1.6em;
62
+ color: #FFF;
63
+ padding: 0.5em 0.8em 0.5em 0.8em;
64
+ }
65
+
66
+ .pb_before { page-break-before: always !important; }
67
+ .pb_after { page-break-after: always !important; }
68
+ .pb_avoid { page-break-inside: avoid !important; }
69
+
70
+ table{
71
+ font-size: 0.95em;
72
+ }
73
+
74
+ td{
75
+ text-align: left;
76
+ padding-left: 1em;
77
+ }
78
+
79
+ th{
80
+ padding-left: 0em;
81
+ color: #777;
82
+ padding: 0.2em 0.5em 0.2em 1em;
83
+ text-align: left;
84
+ vertical-align: top;
85
+ }
86
+
87
+ td:first-child, tr td:nth-child(2) {
88
+ /*font-family: courier;*/
89
+ padding-left: 0em;
90
+ /* color: blue;*/
91
+ white-space: nowrap;
92
+ }
93
+
94
+
95
+ tr th:first-child{
96
+ padding-left: 0em;
97
+ }
98
+
99
+ .api td:first-child, .api td:nth-child(2) {
100
+ font-family: courier;
101
+ padding-left: 0em;
102
+ color: #900;
103
+ white-space: nowrap;
104
+ }
105
+
106
+ .parameters td:first-child {
107
+ font-family: courier;
108
+ padding-left: 0em;
109
+ color: #900;
110
+ white-space: nowrap;
111
+ }
112
+
113
+ .up_arrow:before{
114
+ content: "⬆";
115
+ font-size: 1em;
116
+ color: #6C6;
117
+ }
118
+
119
+ .down_arrow:before{
120
+ content: "⬇";
121
+ font-size: 1em;
122
+ color: #C03;
123
+ }
124
+
125
+ .sample{
126
+ font-family: courier;
127
+ font-size: 0.8em;
128
+ letter-spacing: -0.01px;
129
+ color: #900;
130
+ line-height: 1.2em;
131
+ padding: 0.7em 0.5em 0.7em 0.5em;
132
+ border: 1px dashed #900;
133
+ }
134
+
135
+ .sample strong{
136
+ -webkit-transform: rotate(6deg);
137
+ -moz-transform: rotate(6deg)
138
+ display: inline;
139
+ background: #900;
140
+ padding: 0.3em 0.5em 0.3em 0.5em;
141
+ color: white;
142
+ }
143
+
144
+ pre{
145
+ background-color: #F8F8F8;
146
+ border: 1px solid #CCC;
147
+ padding: 1em;
148
+ font-size: 1.2em;
149
+ page-break-inside: avoid;
150
+ white-space: pre;
151
+ }
152
+
@@ -0,0 +1,6 @@
1
+ body{
2
+ width: 800px;
3
+ margin-left:auto;
4
+ margin-right:auto;
5
+ font-size: 0.9em;
6
+ }
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title><%= @config["full_title"] %></title>
5
+ <base href="root_url">
6
+ <link href="report.css" media="screen, print" rel="stylesheet" type="text/css" />
7
+ <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
8
+ </head>
9
+ <body>
10
+ <img src="images/logo.png" alt="Logo" style="float: right; width: 150px;"/>
11
+ <span class="title"><%= @config["title"] %><br/><small><%= @config["subtitle"]%></small></span>
12
+ <p>Document v0.1 DRAFT - <%= Time.new.strftime('%h %d, %Y %H:%M') %></p>
13
+ <p class="big-heading"><%= @config["document_summary"]%></p>
14
+ <%= @toc %>
15
+ <%= @content %>
16
+ </body>
@@ -0,0 +1 @@
1
+ ###
@@ -0,0 +1,5 @@
1
+ full_title: My Funky API Documentation
2
+ title: Funky API
3
+ subtitle: Version 1.0
4
+ document_summary: |
5
+ This document describes my Funky API. It's automatically generated by Buttless.
@@ -0,0 +1,50 @@
1
+ ---
2
+ - resource: Funky Thing
3
+ methods:
4
+ - path: /api/funky/thing
5
+ resolves_to: /api/funky/thing/info.json
6
+ method: GET
7
+ precis: |
8
+ Returns information about the thing.
9
+ description: |
10
+ parameters:
11
+ example_response: funky_thing
12
+ - resource: Funky Stuff
13
+ methods:
14
+ - path: /api/funky/stuff
15
+ resolves_to: /api/funky/stuff/index.json
16
+ method: GET
17
+ precis: |
18
+ Returns a list of stuff.
19
+ description: |
20
+ This method is very useful.
21
+ parameters:
22
+ example_response: funky_stuff
23
+ - path: /api/funky/stuff/:id/info
24
+ resolves_to: /api/funky/stuff/:id/info.json
25
+ method: GET
26
+ precis: |
27
+ Returns the info about the stuff.
28
+ description:
29
+ parameters:
30
+ - name: id
31
+ example: 1
32
+ precis: The id of the stuff
33
+ example_response: funky_stuff_info
34
+ - path: /api/funky/stuff/:id/info
35
+ resolves_to: /api/funky/stuff/:id/info.json
36
+ method: POST
37
+ precis: |
38
+ Updates stuff.
39
+ description:
40
+ parameters:
41
+ - name: id
42
+ example: 1
43
+ precis: The id of the device
44
+ - name: name
45
+ example: My Stuff
46
+ precis: The new name of the stuff
47
+ optional: false
48
+ type: POST
49
+
50
+ example_response: post_ok
File without changes
@@ -0,0 +1,4 @@
1
+ [
2
+ {"id": 1, "name": "Funky 1"},
3
+ {"id": 2, "name": "Funky 2"}
4
+ ]
@@ -0,0 +1 @@
1
+ {"id": 2, "name": "Funky 2", "description": "This is funky"}
@@ -0,0 +1 @@
1
+ {"id": 2, "name": "Funky Thing"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "result": "ok"
3
+ }