rspec-api-docs 0.10.0 → 0.11.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/.rubocop.yml +6 -9
- data/lib/rspec_api_docs/dsl/doc_proxy.rb +35 -0
- data/lib/rspec_api_docs/formatter/resource/example.rb +3 -0
- data/lib/rspec_api_docs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d10d8bca800c45005afc8f8d95a1f5373885cb6
|
4
|
+
data.tar.gz: 9f88eb3855beceebd31c878a3be6887c6cfc63d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec38ab112edb6805a565d7f220c427c66d77499429e61a4ffb3e689a99fc25e3c73edce2113faabc2d437f8fb175c121154865a623ea338706e15a37a844250
|
7
|
+
data.tar.gz: 79aa77d8356314ac968ab9a9ca9064e0a5f95f0572b5f45a48013e9d07e727dca3fa1e06d52f6706a41d29134b4bc01eeac7cc579d945633bfc8689720f115bd
|
data/.rubocop.yml
CHANGED
@@ -6,16 +6,13 @@ AllCops:
|
|
6
6
|
Metrics/LineLength:
|
7
7
|
Max: 120
|
8
8
|
|
9
|
-
|
10
|
-
Enabled: true
|
11
|
-
|
12
|
-
Style/DotPosition:
|
9
|
+
Layout/DotPosition:
|
13
10
|
EnforcedStyle: leading
|
14
11
|
|
15
|
-
|
12
|
+
Layout/AlignHash:
|
16
13
|
Enabled: true
|
17
14
|
|
18
|
-
|
15
|
+
Layout/ExtraSpacing:
|
19
16
|
AllowForAlignment: false
|
20
17
|
|
21
18
|
Style/HashSyntax:
|
@@ -33,10 +30,10 @@ Style/PercentLiteralDelimiters:
|
|
33
30
|
'%W': '[]'
|
34
31
|
'%x': '[]'
|
35
32
|
|
36
|
-
|
33
|
+
Layout/SpaceInsideHashLiteralBraces:
|
37
34
|
EnforcedStyle: no_space
|
38
35
|
|
39
|
-
|
36
|
+
Layout/SpaceInsideBlockBraces:
|
40
37
|
EnforcedStyleForEmptyBraces: space
|
41
38
|
|
42
39
|
Style/StringLiterals:
|
@@ -51,5 +48,5 @@ Style/TrailingCommaInArguments:
|
|
51
48
|
Style/ClassAndModuleChildren:
|
52
49
|
EnforcedStyle: nested
|
53
50
|
|
54
|
-
|
51
|
+
Layout/MultilineOperationIndentation:
|
55
52
|
EnforcedStyle: indented
|
@@ -146,6 +146,41 @@ module RspecApiDocs
|
|
146
146
|
def precedence(value)
|
147
147
|
metadata[METADATA_NAMESPACE][:example_precedence] = value
|
148
148
|
end
|
149
|
+
|
150
|
+
# For passing a lambda to modify the response body
|
151
|
+
#
|
152
|
+
# This is useful if the entire body of the response isn't relevant to the
|
153
|
+
# documentation example.
|
154
|
+
#
|
155
|
+
# With a response body of:
|
156
|
+
#
|
157
|
+
# {
|
158
|
+
# characters: [
|
159
|
+
# {
|
160
|
+
# id: 1,
|
161
|
+
# name: 'Finn The Human',
|
162
|
+
# },
|
163
|
+
# {
|
164
|
+
# id: 2,
|
165
|
+
# name: 'Jake The Dog',
|
166
|
+
# },
|
167
|
+
# ],
|
168
|
+
# }
|
169
|
+
#
|
170
|
+
# Usage:
|
171
|
+
#
|
172
|
+
# doc do
|
173
|
+
# response_body_after_hook -> (parsed_response_body) {
|
174
|
+
# parsed_response_body[:characters].delete_if { |character| character[:id] != 1 }
|
175
|
+
# parsed_response_body
|
176
|
+
# }
|
177
|
+
# end
|
178
|
+
#
|
179
|
+
# @param value [Lambda] after hook lambda
|
180
|
+
# @return [void]
|
181
|
+
def response_body_after_hook(value)
|
182
|
+
metadata[METADATA_NAMESPACE][:response_body_after_hook] = value
|
183
|
+
end
|
149
184
|
end
|
150
185
|
end
|
151
186
|
end
|
@@ -130,6 +130,9 @@ module RspecApiDocs
|
|
130
130
|
DeepHashSet.call(parsed_body, f.scope + [f.name], f.example)
|
131
131
|
end
|
132
132
|
end
|
133
|
+
if metadata[:response_body_after_hook]
|
134
|
+
parsed_body = metadata[:response_body_after_hook].call(parsed_body)
|
135
|
+
end
|
133
136
|
JSON.dump(parsed_body)
|
134
137
|
end
|
135
138
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-api-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Odin Dutton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|