rspec_api_documentation 0.9.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/lib/rspec_api_documentation.rb +11 -8
  2. data/lib/rspec_api_documentation/api_documentation.rb +1 -2
  3. data/lib/rspec_api_documentation/configuration.rb +0 -2
  4. data/lib/rspec_api_documentation/curl.rb +1 -1
  5. data/lib/rspec_api_documentation/example.rb +1 -1
  6. data/lib/rspec_api_documentation/writers/combined_json_writer.rb +20 -0
  7. data/lib/rspec_api_documentation/writers/combined_text_writer.rb +106 -0
  8. data/lib/rspec_api_documentation/writers/formatter.rb +11 -0
  9. data/lib/rspec_api_documentation/writers/html_writer.rb +102 -0
  10. data/lib/rspec_api_documentation/writers/index_writer.rb +16 -0
  11. data/lib/rspec_api_documentation/writers/json_iodocs_writer.rb +111 -0
  12. data/lib/rspec_api_documentation/writers/json_writer.rb +111 -0
  13. data/templates/rspec_api_documentation/html_example.mustache +12 -41
  14. data/templates/rspec_api_documentation/html_index.mustache +9 -2
  15. metadata +10 -28
  16. data/lib/rspec_api_documentation/combined_json_writer.rb +0 -18
  17. data/lib/rspec_api_documentation/combined_text_writer.rb +0 -104
  18. data/lib/rspec_api_documentation/html_writer.rb +0 -107
  19. data/lib/rspec_api_documentation/index_writer.rb +0 -14
  20. data/lib/rspec_api_documentation/json_iodocs_writer.rb +0 -107
  21. data/lib/rspec_api_documentation/json_writer.rb +0 -111
  22. data/lib/rspec_api_documentation/wurl_writer.rb +0 -110
  23. data/templates/assets/img/glyphicons-halflings-white.png +0 -0
  24. data/templates/assets/img/glyphicons-halflings.png +0 -0
  25. data/templates/assets/javascripts/application.js +0 -250
  26. data/templates/assets/javascripts/codemirror.js +0 -3636
  27. data/templates/assets/javascripts/jquery-1-7-2.js +0 -9401
  28. data/templates/assets/javascripts/jquery-base64.js +0 -189
  29. data/templates/assets/javascripts/jquery-livequery.js +0 -226
  30. data/templates/assets/javascripts/jquery-ui-1-8-16-min.js +0 -791
  31. data/templates/assets/javascripts/mode/css/css.js +0 -124
  32. data/templates/assets/javascripts/mode/htmlmixed/htmlmixed.js +0 -85
  33. data/templates/assets/javascripts/mode/javascript/javascript.js +0 -361
  34. data/templates/assets/javascripts/mode/xml/xml.js +0 -325
  35. data/templates/assets/stylesheets/application.css +0 -68
  36. data/templates/assets/stylesheets/bootstrap.css +0 -4960
  37. data/templates/assets/stylesheets/codemirror.css +0 -230
  38. data/templates/rspec_api_documentation/example.json +0 -1
  39. data/templates/rspec_api_documentation/index.json +0 -1
  40. data/templates/rspec_api_documentation/wurl_example.mustache +0 -242
  41. data/templates/rspec_api_documentation/wurl_index.mustache +0 -27
@@ -1,230 +0,0 @@
1
- .CodeMirror {
2
- line-height: 1em;
3
- font-family: monospace;
4
- }
5
-
6
- .CodeMirror-scroll {
7
- overflow: auto;
8
- height: 300px;
9
- /* This is needed to prevent an IE[67] bug where the scrolled content
10
- is visible outside of the scrolling box. */
11
- position: relative;
12
- outline: none;
13
- }
14
-
15
- .CodeMirror-gutter {
16
- position: absolute;
17
- left: 0;
18
- top: 0;
19
- z-index: 10;
20
- background-color: #f7f7f7;
21
- border-right: 1px solid #eee;
22
- min-width: 2em;
23
- height: 100%;
24
- }
25
-
26
- .CodeMirror-gutter-text {
27
- color: #aaa;
28
- text-align: right;
29
- padding: .4em .2em .4em .4em;
30
- white-space: pre !important;
31
- }
32
-
33
- .CodeMirror-lines {
34
- padding: .4em;
35
- white-space: pre;
36
- }
37
-
38
- .CodeMirror pre {
39
- -moz-border-radius: 0;
40
- -webkit-border-radius: 0;
41
- -o-border-radius: 0;
42
- border-radius: 0;
43
- border-width: 0;
44
- margin: 0;
45
- padding: 0;
46
- background: transparent;
47
- font-family: inherit;
48
- font-size: inherit;
49
- padding: 0;
50
- margin: 0;
51
- white-space: pre;
52
- word-wrap: normal;
53
- line-height: inherit;
54
- color: inherit;
55
- }
56
-
57
- .CodeMirror-wrap pre {
58
- word-wrap: break-word;
59
- white-space: pre-wrap;
60
- word-break: normal;
61
- }
62
-
63
- .CodeMirror-wrap .CodeMirror-scroll {
64
- overflow-x: hidden;
65
- }
66
-
67
- .CodeMirror textarea {
68
- outline: none !important;
69
- }
70
-
71
- .CodeMirror pre.CodeMirror-cursor {
72
- z-index: 10;
73
- position: absolute;
74
- visibility: hidden;
75
- border-left: 1px solid black;
76
- border-right: none;
77
- width: 0;
78
- }
79
-
80
- .cm-keymap-fat-cursor pre.CodeMirror-cursor {
81
- width: auto;
82
- border: 0;
83
- background: transparent;
84
- background: rgba(0, 200, 0, .4);
85
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = #6600c800, endColorstr = #4c00c800);
86
- }
87
-
88
- /* Kludge to turn off filter in ie9+, which also accepts rgba */
89
- .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
90
- filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
91
- }
92
-
93
- .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {
94
- }
95
-
96
- .CodeMirror-focused pre.CodeMirror-cursor {
97
- visibility: visible;
98
- }
99
-
100
- div.CodeMirror-selected {
101
- background: #d9d9d9;
102
- }
103
-
104
- .CodeMirror-focused div.CodeMirror-selected {
105
- background: #d7d4f0;
106
- }
107
-
108
- .CodeMirror-searching {
109
- background: #ffa;
110
- background: rgba(255, 255, 0, .4);
111
- }
112
-
113
- /* Default theme */
114
-
115
- .cm-s-default span.cm-keyword {
116
- color: #708;
117
- }
118
-
119
- .cm-s-default span.cm-atom {
120
- color: #219;
121
- }
122
-
123
- .cm-s-default span.cm-number {
124
- color: #164;
125
- }
126
-
127
- .cm-s-default span.cm-def {
128
- color: #00f;
129
- }
130
-
131
- .cm-s-default span.cm-variable {
132
- color: black;
133
- }
134
-
135
- .cm-s-default span.cm-variable-2 {
136
- color: #05a;
137
- }
138
-
139
- .cm-s-default span.cm-variable-3 {
140
- color: #085;
141
- }
142
-
143
- .cm-s-default span.cm-property {
144
- color: black;
145
- }
146
-
147
- .cm-s-default span.cm-operator {
148
- color: black;
149
- }
150
-
151
- .cm-s-default span.cm-comment {
152
- color: #a50;
153
- }
154
-
155
- .cm-s-default span.cm-string {
156
- color: #a11;
157
- }
158
-
159
- .cm-s-default span.cm-string-2 {
160
- color: #f50;
161
- }
162
-
163
- .cm-s-default span.cm-meta {
164
- color: #555;
165
- }
166
-
167
- .cm-s-default span.cm-error {
168
- color: #f00;
169
- }
170
-
171
- .cm-s-default span.cm-qualifier {
172
- color: #555;
173
- }
174
-
175
- .cm-s-default span.cm-builtin {
176
- color: #30a;
177
- }
178
-
179
- .cm-s-default span.cm-bracket {
180
- color: #cc7;
181
- }
182
-
183
- .cm-s-default span.cm-tag {
184
- color: #170;
185
- }
186
-
187
- .cm-s-default span.cm-attribute {
188
- color: #00c;
189
- }
190
-
191
- .cm-s-default span.cm-header {
192
- color: #a0a;
193
- }
194
-
195
- .cm-s-default span.cm-quote {
196
- color: #090;
197
- }
198
-
199
- .cm-s-default span.cm-hr {
200
- color: #999;
201
- }
202
-
203
- .cm-s-default span.cm-link {
204
- color: #00c;
205
- }
206
-
207
- span.cm-header, span.cm-strong {
208
- font-weight: bold;
209
- }
210
-
211
- span.cm-em {
212
- font-style: italic;
213
- }
214
-
215
- span.cm-emstrong {
216
- font-style: italic;
217
- font-weight: bold;
218
- }
219
-
220
- span.cm-link {
221
- text-decoration: underline;
222
- }
223
-
224
- div.CodeMirror span.CodeMirror-matchingbracket {
225
- color: #0f0;
226
- }
227
-
228
- div.CodeMirror span.CodeMirror-nonmatchingbracket {
229
- color: #f22;
230
- }
@@ -1 +0,0 @@
1
- {{{ json }}}
@@ -1 +0,0 @@
1
- {{{ json }}}
@@ -1,242 +0,0 @@
1
- <!DOCTYPE html>
2
- <head>
3
- <title>{{resource_name}} API</title>
4
- <meta charset="utf-8">
5
- <link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/bootstrap.css"/>
6
- <link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/codemirror.css"/>
7
- <link rel="stylesheet" href="{{url_prefix}}/assets/stylesheets/application.css"/>
8
- <script src="{{url_prefix}}/assets/javascripts/jquery-1-7-2.js"></script>
9
- <script src="{{url_prefix}}/assets/javascripts/jquery-livequery.js"></script>
10
- <script src="{{url_prefix}}/assets/javascripts/jquery-base64.js"></script>
11
- <script src="{{url_prefix}}/assets/javascripts/jquery-ui-1-8-16-min.js"></script>
12
- <script src="{{url_prefix}}/assets/javascripts/codemirror.js"></script>
13
- <script src="{{url_prefix}}/assets/javascripts/mode/css/css.js"></script>
14
- <script src="{{url_prefix}}/assets/javascripts/mode/htmlmixed/htmlmixed.js"></script>
15
- <script src="{{url_prefix}}/assets/javascripts/mode/javascript/javascript.js"></script>
16
- <script src="{{url_prefix}}/assets/javascripts/mode/xml/xml.js"></script>
17
- <script src="{{url_prefix}}/assets/javascripts/application.js"></script>
18
- <script>
19
-
20
- </script>
21
- <style>
22
- td.required .name:after {
23
- float: right;
24
- content: "required";
25
- font-weight: normal;
26
- color: #F08080;
27
- }
28
-
29
- p {
30
- padding: 15px;
31
- font-size: 130%;
32
- }
33
- </style>
34
- </head>
35
- <body>
36
- <div class="container">
37
- <h1>{{resource_name}} API</h1>
38
-
39
- <div class="article">
40
- <h2>{{ description }}</h2>
41
- {{# explanation }}
42
- <p class="explanation">
43
- {{ explanation }}
44
- </p>
45
- {{/ explanation }}
46
-
47
- {{# has_parameters? }}
48
- <h3>Parameters</h3>
49
- <table class="parameters table table-striped table-bordered table-condensed">
50
- <thead>
51
- <tr>
52
- <th>Name</th>
53
- <th>Description</th>
54
- </tr>
55
- </thead>
56
- <tbody>
57
- {{# parameters }}
58
- <tr>
59
- <td
60
- {{# required }} class="required"{{/ required }}>
61
- <span class="name">{{ name }}</span>
62
- </td>
63
- <td>
64
- <span class="description">{{ description }}</span>
65
- </td>
66
- </tr>
67
- {{/ parameters }}
68
- </tbody>
69
- </table>
70
- {{/ has_parameters? }}
71
-
72
- {{# requests }}
73
- <div class='request'>
74
- <h3>Request</h3>
75
-
76
- <h4>Headers</h4>
77
- <pre class="request headers">{{ request_headers_text }}</pre>
78
-
79
- <h4>Route</h4>
80
- <pre class="request route highlight">{{ request_method }} {{ request_path }}</pre>
81
-
82
- {{# request_query_parameters_text }}
83
- <h4>Query Parameters</h4>
84
- <pre class="request query_parameters highlight">{{ request_query_parameters_text }}</pre>
85
- {{/ request_query_parameters_text }}
86
-
87
- {{# request_body }}
88
- <h4>Body</h4>
89
-
90
- <div class="request body"><textarea>{{ request_body }}</textarea></div>
91
- {{/ request_body }}
92
-
93
- {{# curl }}
94
- <h4>cURL</h4>
95
- <pre class="request">{{ curl }}</pre>
96
- {{/ curl }}
97
-
98
- <h4>wURL</h4>
99
-
100
- <div class="wurl_form form-horizontal" id="wurl_form">
101
- <form accept-charset="UTF-8" class="new_wurl well" id="new_wurl">
102
- <input type="hidden" class="request content_type" value="{{request_content_type}}"/>
103
- <input type="hidden" class="response content_type" value="{{response_content_type}}"/>
104
-
105
- <div class="control-group">
106
- <label class="control-label">
107
- URL
108
- </label>
109
-
110
- <div class="controls url">
111
- <select id="wurl_request_method" name="wurl[request_method]">
112
- <option value="{{ request_method }}" selected="true">{{ request_method }}</option>
113
- <option value="GET">GET</option>
114
- <option value="POST">POST</option>
115
- <option value="PUT">PUT</option>
116
- <option value="DELETE">DELETE</option>
117
- <option value="HEAD">HEAD</option>
118
- </select>
119
- <input id="wurl_request_url" name="wurl[request_url]" value="{{ request_path_no_query }}">
120
- </div>
121
- </div>
122
- <div class="control-group">
123
- <label class="control-label">
124
- Basic Auth
125
- </label>
126
-
127
- <div class="controls">
128
- <div class="field_pair">
129
- <input id="wurl_basic_auth_user" name="wurl[basic_auth_user]" placeholder="username">
130
- <input id="wurl_basic_auth_password" name="wurl[basic_auth_password]"
131
- placeholder="password">
132
- </div>
133
- </div>
134
- </div>
135
- <div class="control-group">
136
- <label class="control-label with-button">
137
- <a class="btn trash_headers btn-small btn-danger" title="trash all headers"><i
138
- class="icon-trash icon-white"></i></a>
139
- <a class="btn add_header btn-small btn-inverse" title="add header"><i
140
- class="icon-plus icon-white"></i></a>
141
- <span class="text">Headers</span>
142
- </label>
143
-
144
- <div class="headers controls">
145
- <div class="header_pair" style="display:none">
146
- <input class="key ui-autocomplete-input" disabled="disabled" id="header_keys_"
147
- name="header_keys[]"
148
- type="text" autocomplete="off" role="textbox" aria-autocomplete="list"
149
- aria-haspopup="true">
150
- <input class="value" disabled="disabled" id="header_values_" name="header_values[]"
151
- type="text">
152
- <a class="btn delete_header btn-small btn-danger" title="delete header"><i
153
- class="icon-remove icon-white"></i></a>
154
- </div>
155
-
156
- {{# request_headers_hash }}
157
- <div class="header_pair">
158
- <input class="key ui-autocomplete-input" id="header_keys_" name="header_keys[]"
159
- type="text"
160
- autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"
161
- value="{{ name }}">
162
- <input class="value" id="header_values_" name="header_values[]" type="text"
163
- value="{{ value }}">
164
- <a class="btn delete_header btn-small btn-danger" title="delete header"><i
165
- class="icon-remove icon-white"></i></a>
166
- </div>
167
- {{/ request_headers_hash }}
168
-
169
- </div>
170
- </div>
171
- <div class="control-group">
172
- <label class="control-label">
173
- <a class="btn trash_queries btn-small btn-danger" title="trash all parameters"><i
174
- class="icon-trash icon-white"></i></a>
175
- <a class="btn add_param btn-small btn-inverse" title="add parameter"><i
176
- class="icon-plus icon-white"></i></a>
177
- <span>Query</span>
178
- </label>
179
-
180
- <div class="params controls">
181
- <div class="param_pair" style="display:none">
182
- <input class="key" disabled="disabled" id="param_keys_" name="param_keys[]" type="text">
183
- <input class="value" disabled="disabled" id="param_values_" name="param_values[]"
184
- type="text">
185
- <a class="btn delete_param btn-small btn-danger" title="delete parameter"><i
186
- class="icon-remove icon-white"></i></a>
187
- </div>
188
- {{# request_query_parameters_hash }}
189
-
190
- <div class="param_pair">
191
- <input class="key" id="param_keys_" name="param_keys[]" type="text" value="{{ name }}">
192
- <input class="value" id="param_values_" name="param_values[]" type="text"
193
- value="{{ value }}">
194
- <a class="btn delete_param btn-small btn-danger" title="delete parameter"><i
195
- class="icon-remove icon-white"></i></a>
196
- </div>
197
- {{/ request_query_parameters_hash }}
198
-
199
-
200
- </div>
201
- </div>
202
- <div class="control-group">
203
- <label class="control-label">
204
- <span>Body</span>
205
- </label>
206
-
207
- <div class="post_body controls">
208
- <textarea id="wurl_request_body" name="wurl[request_body]" rows="5"
209
- disabled="disabled"
210
- class="textarea_disabled">{{ request_body }}</textarea>
211
- </div>
212
- </div>
213
- <div class="control-group">
214
- <div class="controls">
215
- <input class="clear_fields btn" id="clear_fields" type="button" value="Clear">
216
- <input class="give_it_a_wurl btn btn-primary" type="submit" value="Give it a Wurl!">
217
- </div>
218
- </div>
219
- </form>
220
-
221
- <h3><a class="response_anchor"></a>Response</h3>
222
- <h4>Headers</h4>
223
- <pre class="response headers">{{ response_headers_text }}</pre>
224
-
225
- {{# response_status }}
226
- <h4>Status</h4>
227
- <pre class="response status">{{ response_status }}</pre>
228
- {{/ response_status }}
229
-
230
- {{# response_body }}
231
- <h4>Body</h4>
232
-
233
- <div class="response body"><textarea>{{{ response_body }}}</textarea></div>
234
- {{/ response_body }}
235
- </div>
236
- </div>
237
- <hr/>
238
- {{/ requests }}
239
- </div>
240
- </div>
241
- </body>
242
- </html>