rspec_api_documentation 4.1.0 → 4.2.0
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.
- checksums.yaml +4 -4
- data/lib/rspec_api_documentation/assets/stylesheets/rspec_api_documentation/styles.css +102 -0
- data/lib/rspec_api_documentation/configuration.rb +1 -0
- data/lib/rspec_api_documentation/dsl/endpoint.rb +13 -11
- data/lib/rspec_api_documentation/views/html_example.rb +6 -0
- data/lib/rspec_api_documentation/views/html_index.rb +6 -0
- data/templates/rspec_api_documentation/html_example.mustache +2 -22
- data/templates/rspec_api_documentation/html_index.mustache +1 -6
- metadata +3 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e8850c767dbaf09a5469f45db448b6119a1d9d
|
4
|
+
data.tar.gz: 7b83d526470ad8734fa2bdaa8c22d48792da4dd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75314c9d799bc9296b7b3217e08261cf0df0b6bb4ba3ece99faaf36f2b08fa31a4ffba57a4b745bf877aa919937ecbbe2237ccd66bd62e0ad62d27da34c04a8
|
7
|
+
data.tar.gz: 50ef1cca010fb51adaaf3d8776e17d6fb5ed6b89baa65d377b5eb4153d59c0ea4396e482f206f6592d8044df50258ade305466e324f03789627dc7c7396cafcb
|
@@ -0,0 +1,102 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Helvetica,Arial,sans-serif;
|
4
|
+
font-size: 13px;
|
5
|
+
font-weight: normal;
|
6
|
+
line-height: 18px;
|
7
|
+
color: #404040;
|
8
|
+
}
|
9
|
+
|
10
|
+
.container {
|
11
|
+
width: 940px;
|
12
|
+
margin-left: auto;
|
13
|
+
margin-right: auto;
|
14
|
+
zoom: 1;
|
15
|
+
}
|
16
|
+
|
17
|
+
pre {
|
18
|
+
background-color: #f5f5f5;
|
19
|
+
display: block;
|
20
|
+
padding: 8.5px;
|
21
|
+
margin: 0 0 18px;
|
22
|
+
line-height: 18px;
|
23
|
+
font-size: 12px;
|
24
|
+
border: 1px solid #ccc;
|
25
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
26
|
+
-webkit-border-radius: 3px;
|
27
|
+
-moz-border-radius: 3px;
|
28
|
+
border-radius: 3px;
|
29
|
+
white-space: pre;
|
30
|
+
white-space: pre-wrap;
|
31
|
+
word-wrap: break-word;
|
32
|
+
}
|
33
|
+
|
34
|
+
td.required .name:after {
|
35
|
+
float: right;
|
36
|
+
content: "required";
|
37
|
+
font-weight: normal;
|
38
|
+
color: #F08080;
|
39
|
+
}
|
40
|
+
|
41
|
+
a{
|
42
|
+
color: #0069d6;
|
43
|
+
text-decoration: none;
|
44
|
+
line-height: inherit;
|
45
|
+
font-weight: inherit;
|
46
|
+
}
|
47
|
+
|
48
|
+
p {
|
49
|
+
padding: 15px;
|
50
|
+
font-size: 130%;
|
51
|
+
}
|
52
|
+
|
53
|
+
h1, h2, h3, h4, h5, h6 {
|
54
|
+
font-weight: bold;
|
55
|
+
color: #404040;
|
56
|
+
}
|
57
|
+
|
58
|
+
h1 {
|
59
|
+
margin-bottom: 18px;
|
60
|
+
font-size: 30px;
|
61
|
+
line-height: 36px;
|
62
|
+
}
|
63
|
+
h2 {
|
64
|
+
font-size: 24px;
|
65
|
+
line-height: 36px;
|
66
|
+
}
|
67
|
+
h3{
|
68
|
+
font-size: 18px;
|
69
|
+
line-height: 36px;
|
70
|
+
}
|
71
|
+
h4 {
|
72
|
+
font-size: 16px;
|
73
|
+
line-height: 36px;
|
74
|
+
}
|
75
|
+
|
76
|
+
table{
|
77
|
+
width: 100%;
|
78
|
+
margin-bottom: 18px;
|
79
|
+
padding: 0;
|
80
|
+
border-collapse: separate;
|
81
|
+
font-size: 13px;
|
82
|
+
-webkit-border-radius: 4px;
|
83
|
+
-moz-border-radius: 4px;
|
84
|
+
border-radius: 4px;
|
85
|
+
border-spacing: 0;
|
86
|
+
border: 1px solid #ddd;
|
87
|
+
}
|
88
|
+
|
89
|
+
table th {
|
90
|
+
padding-top: 9px;
|
91
|
+
font-weight: bold;
|
92
|
+
vertical-align: middle;
|
93
|
+
border-bottom: 1px solid #ddd;
|
94
|
+
}
|
95
|
+
table th+th, table td+td {
|
96
|
+
border-left: 1px solid #ddd;
|
97
|
+
}
|
98
|
+
table th, table td {
|
99
|
+
padding: 10px 10px 9px;
|
100
|
+
line-height: 18px;
|
101
|
+
text-align: left;
|
102
|
+
}
|
@@ -78,6 +78,7 @@ module RspecApiDocumentation
|
|
78
78
|
add_setting :io_docs_protocol, :default => "http"
|
79
79
|
add_setting :request_headers_to_include, :default => nil
|
80
80
|
add_setting :response_headers_to_include, :default => nil
|
81
|
+
add_setting :html_embedded_css_file, :default => nil
|
81
82
|
|
82
83
|
# Change how the post body is formatted by default, you can still override by `raw_post`
|
83
84
|
# Can be :json, :xml, or a proc that will be passed the params
|
@@ -38,19 +38,21 @@ module RspecApiDocumentation::DSL
|
|
38
38
|
if method == :get && !query_string.blank?
|
39
39
|
path_or_query += "?#{query_string}"
|
40
40
|
else
|
41
|
-
|
42
|
-
|
43
|
-
when :json
|
44
|
-
params_or_body = params.to_json
|
45
|
-
when :xml
|
46
|
-
params_or_body = params.to_xml
|
47
|
-
when Proc
|
48
|
-
params_or_body = formatter.call(params)
|
41
|
+
if respond_to?(:raw_post)
|
42
|
+
params_or_body = raw_post
|
49
43
|
else
|
50
|
-
|
44
|
+
formatter = RspecApiDocumentation.configuration.post_body_formatter
|
45
|
+
case formatter
|
46
|
+
when :json
|
47
|
+
params_or_body = params.to_json
|
48
|
+
when :xml
|
49
|
+
params_or_body = params.to_xml
|
50
|
+
when Proc
|
51
|
+
params_or_body = formatter.call(params)
|
52
|
+
else
|
53
|
+
params_or_body = params
|
54
|
+
end
|
51
55
|
end
|
52
|
-
|
53
|
-
params_or_body = respond_to?(:raw_post) ? raw_post : params_or_body
|
54
56
|
end
|
55
57
|
|
56
58
|
rspec_api_documentation_client.send(method, path_or_query, params_or_body, headers)
|
@@ -11,6 +11,12 @@ module RspecApiDocumentation
|
|
11
11
|
def extension
|
12
12
|
EXTENSION
|
13
13
|
end
|
14
|
+
|
15
|
+
def styles
|
16
|
+
app_styles_url = RspecApiDocumentation.configuration.html_embedded_css_file
|
17
|
+
gem_styles_url = File.join(File.dirname(__FILE__), "..", "assets", "stylesheets","rspec_api_documentation", "styles.css")
|
18
|
+
return File.read(app_styles_url) rescue File.read(gem_styles_url)
|
19
|
+
end
|
14
20
|
end
|
15
21
|
end
|
16
22
|
end
|
@@ -6,6 +6,12 @@ module RspecApiDocumentation
|
|
6
6
|
self.template_name = "rspec_api_documentation/html_index"
|
7
7
|
end
|
8
8
|
|
9
|
+
def styles
|
10
|
+
app_styles_url = RspecApiDocumentation.configuration.html_embedded_css_file
|
11
|
+
gem_styles_url = File.join(File.dirname(__FILE__), "..", "assets", "stylesheets","rspec_api_documentation", "styles.css")
|
12
|
+
return File.read(app_styles_url) rescue File.read(gem_styles_url)
|
13
|
+
end
|
14
|
+
|
9
15
|
def examples
|
10
16
|
@index.examples.map { |example| HtmlExample.new(example, @configuration) }
|
11
17
|
end
|
@@ -4,27 +4,7 @@
|
|
4
4
|
<title>{{resource_name}} API</title>
|
5
5
|
<meta charset="utf-8">
|
6
6
|
<style>
|
7
|
-
|
8
|
-
float: right;
|
9
|
-
content: "required";
|
10
|
-
font-weight: normal;
|
11
|
-
color: #F08080;
|
12
|
-
}
|
13
|
-
|
14
|
-
p {
|
15
|
-
padding: 15px;
|
16
|
-
font-size: 130%;
|
17
|
-
}
|
18
|
-
|
19
|
-
pre {
|
20
|
-
white-space: pre-wrap;
|
21
|
-
}
|
22
|
-
|
23
|
-
body {
|
24
|
-
margin-left: auto;
|
25
|
-
margin-right: auto;
|
26
|
-
width: 900px;
|
27
|
-
}
|
7
|
+
{{ styles }}
|
28
8
|
</style>
|
29
9
|
</head>
|
30
10
|
<body>
|
@@ -130,7 +110,7 @@
|
|
130
110
|
<pre class="response status">{{ response_status }} {{ response_status_text}}</pre>
|
131
111
|
{{# response_body }}
|
132
112
|
<h4>Body</h4>
|
133
|
-
<pre class="response body">{{
|
113
|
+
<pre class="response body">{{ response_body }}</pre>
|
134
114
|
{{/ response_body }}
|
135
115
|
{{/ response_status }}
|
136
116
|
{{/ requests }}
|
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: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Cahoon
|
@@ -10,15 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0.0
|
22
19
|
- - ">="
|
23
20
|
- !ruby/object:Gem::Version
|
24
21
|
version: 3.0.0
|
@@ -26,9 +23,6 @@ dependencies:
|
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
requirements:
|
29
|
-
- - "~>"
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: 3.0.0
|
32
26
|
- - ">="
|
33
27
|
- !ruby/object:Gem::Version
|
34
28
|
version: 3.0.0
|
@@ -224,6 +218,7 @@ files:
|
|
224
218
|
- lib/rspec_api_documentation.rb
|
225
219
|
- lib/rspec_api_documentation/api_documentation.rb
|
226
220
|
- lib/rspec_api_documentation/api_formatter.rb
|
221
|
+
- lib/rspec_api_documentation/assets/stylesheets/rspec_api_documentation/styles.css
|
227
222
|
- lib/rspec_api_documentation/client_base.rb
|
228
223
|
- lib/rspec_api_documentation/configuration.rb
|
229
224
|
- lib/rspec_api_documentation/curl.rb
|