rspec_api_documentation 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rspec_api_documentation/dsl.rb +2 -2
- data/lib/rspec_api_documentation/test_client.rb +2 -2
- data/templates/rspec_api_documentation/example.json +1 -0
- data/templates/rspec_api_documentation/html_example.mustache +90 -0
- data/templates/rspec_api_documentation/html_index.mustache +25 -0
- data/templates/rspec_api_documentation/index.json +1 -0
- metadata +32 -28
@@ -26,14 +26,14 @@ module RspecApiDocumentation
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def last_headers
|
29
|
-
headers =
|
29
|
+
headers = last_request.env.select do |k, v|
|
30
30
|
k =~ /^(HTTP_|CONTENT_TYPE)/
|
31
31
|
end
|
32
32
|
Hash[headers]
|
33
33
|
end
|
34
34
|
|
35
35
|
def last_query_string
|
36
|
-
|
36
|
+
last_request.env["QUERY_STRING"]
|
37
37
|
end
|
38
38
|
|
39
39
|
def last_query_hash
|
@@ -0,0 +1 @@
|
|
1
|
+
{{{ json }}}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>{{resource_name}} API</title>
|
4
|
+
<link rel="stylesheet" href="http://zipmark.github.com/rspec_api_documentation/css/1.3.0/bootstrap.min.css">
|
5
|
+
<style>
|
6
|
+
td.required .name:after {
|
7
|
+
float: right;
|
8
|
+
content: "required";
|
9
|
+
font-weight: normal;
|
10
|
+
color: #F08080;
|
11
|
+
}
|
12
|
+
|
13
|
+
p {
|
14
|
+
padding: 15px;
|
15
|
+
font-size: 130%;
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div class="container">
|
21
|
+
<h1>{{resource_name}} API</h1>
|
22
|
+
|
23
|
+
<div class="article">
|
24
|
+
<h2>{{ description }}</h2>
|
25
|
+
{{# explanation }}
|
26
|
+
<p class="explanation">
|
27
|
+
{{ explanation }}
|
28
|
+
</p>
|
29
|
+
{{/ explanation }}
|
30
|
+
|
31
|
+
{{# has_parameters? }}
|
32
|
+
<h3>Parameters</h3>
|
33
|
+
<table class="parameters">
|
34
|
+
<thead>
|
35
|
+
<tr>
|
36
|
+
<th>Name</th>
|
37
|
+
<th>Description</th>
|
38
|
+
</tr>
|
39
|
+
</thead>
|
40
|
+
<tbody>
|
41
|
+
{{# parameters }}
|
42
|
+
<tr>
|
43
|
+
<td{{# required }} class="required"{{/ required }}>
|
44
|
+
<span class="name">{{ name }}</span>
|
45
|
+
</td>
|
46
|
+
<td>
|
47
|
+
<span class="description">{{ description }}</span>
|
48
|
+
</td>
|
49
|
+
</tr>
|
50
|
+
{{/ parameters }}
|
51
|
+
</tbody>
|
52
|
+
</table>
|
53
|
+
{{/ has_parameters? }}
|
54
|
+
|
55
|
+
{{# requests }}
|
56
|
+
<h3>Request</h3>
|
57
|
+
<h4>Headers</h4>
|
58
|
+
<pre class="request headers">{{ request_headers }}</pre>
|
59
|
+
<h4>Route</h4>
|
60
|
+
<pre class="request route highlight">{{ http_method }} {{ route }}</pre>
|
61
|
+
{{# request_query_parameters }}
|
62
|
+
<h4>Query Parameters</h4>
|
63
|
+
<pre class="request query_parameters highlight">{{ request_query_parameters }}</pre>
|
64
|
+
{{/ request_query_parameters }}
|
65
|
+
{{# request_body }}
|
66
|
+
<h4>Body</h4>
|
67
|
+
<pre class="request highlight">{{ request_body }}</pre>
|
68
|
+
{{/ request_body }}
|
69
|
+
|
70
|
+
{{# curl }}
|
71
|
+
<h4>Curl</h4>
|
72
|
+
<pre class="request">{{ curl }}</pre>
|
73
|
+
{{/ curl }}
|
74
|
+
|
75
|
+
{{# response_status }}
|
76
|
+
<h3>Response</h3>
|
77
|
+
<h4>Headers</h4>
|
78
|
+
<pre class="response headers">{{ response_headers }}</pre>
|
79
|
+
<h4>Status</h4>
|
80
|
+
<pre class="response status">{{ response_status }} {{ response_status_text}}</pre>
|
81
|
+
{{# response_body }}
|
82
|
+
<h4>Body</h4>
|
83
|
+
<pre class="response body highlight">{{ response_body }}</pre>
|
84
|
+
{{/ response_body }}
|
85
|
+
{{/ response_status }}
|
86
|
+
{{/ requests }}
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
</body>
|
90
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>API Documentation</title>
|
4
|
+
<link rel="stylesheet" href="http://zipmark.github.com/rspec_api_documentation/css/1.3.0/bootstrap.min.css">
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<div class="container">
|
8
|
+
<h1>API Documentation</h1>
|
9
|
+
|
10
|
+
{{# sections }}
|
11
|
+
<div class="article">
|
12
|
+
<h2>{{ resource_name }}</h2>
|
13
|
+
|
14
|
+
<ul>
|
15
|
+
{{# examples }}
|
16
|
+
<li>
|
17
|
+
<a href="{{ url_prefix }}{{ dirname }}/{{ filename }}">{{ description }}</a>
|
18
|
+
</li>
|
19
|
+
{{/ examples }}
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
{{/ sections }}
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
{{{ json }}}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_api_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-03
|
14
|
+
date: 2012-04-03 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: &
|
18
|
+
requirement: &70121277388400 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 2.6.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70121277388400
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
|
-
requirement: &
|
29
|
+
requirement: &70121277387560 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 3.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70121277387560
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: i18n
|
40
|
-
requirement: &
|
40
|
+
requirement: &70121277386040 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 0.1.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70121277386040
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rack-test
|
51
|
-
requirement: &
|
51
|
+
requirement: &70121277384380 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.5.5
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70121277384380
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: mustache
|
62
|
-
requirement: &
|
62
|
+
requirement: &70121277383220 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 0.99.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70121277383220
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: webmock
|
73
|
-
requirement: &
|
73
|
+
requirement: &70121277382640 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: 1.7.0
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70121277382640
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: json
|
84
|
-
requirement: &
|
84
|
+
requirement: &70121277370000 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: 1.4.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70121277370000
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: fakefs
|
95
|
-
requirement: &
|
95
|
+
requirement: &70121277369620 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70121277369620
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: sinatra
|
106
|
-
requirement: &
|
106
|
+
requirement: &70121277369140 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70121277369140
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: builder
|
117
|
-
requirement: &
|
117
|
+
requirement: &70121277368700 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70121277368700
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: aruba
|
128
|
-
requirement: &
|
128
|
+
requirement: &70121277368240 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ! '>='
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *70121277368240
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: capybara
|
139
|
-
requirement: &
|
139
|
+
requirement: &70121277367700 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ! '>='
|
@@ -144,10 +144,10 @@ dependencies:
|
|
144
144
|
version: '0'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *70121277367700
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: rake
|
150
|
-
requirement: &
|
150
|
+
requirement: &70121277367180 !ruby/object:Gem::Requirement
|
151
151
|
none: false
|
152
152
|
requirements:
|
153
153
|
- - ! '>='
|
@@ -155,7 +155,7 @@ dependencies:
|
|
155
155
|
version: '0'
|
156
156
|
type: :development
|
157
157
|
prerelease: false
|
158
|
-
version_requirements: *
|
158
|
+
version_requirements: *70121277367180
|
159
159
|
description: Generate API docs from your test suite
|
160
160
|
email:
|
161
161
|
- chris@smartlogicsolutions.com
|
@@ -180,6 +180,10 @@ files:
|
|
180
180
|
- lib/rspec_api_documentation/test_server.rb
|
181
181
|
- lib/rspec_api_documentation.rb
|
182
182
|
- lib/tasks/docs.rake
|
183
|
+
- templates/rspec_api_documentation/example.json
|
184
|
+
- templates/rspec_api_documentation/html_example.mustache
|
185
|
+
- templates/rspec_api_documentation/html_index.mustache
|
186
|
+
- templates/rspec_api_documentation/index.json
|
183
187
|
homepage: http://smartlogicsolutions.com
|
184
188
|
licenses: []
|
185
189
|
post_install_message:
|