rspec_api_documentation 4.0.0 → 4.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fdee8e89c27e8a561132407268a857e5b19aa8f
|
4
|
+
data.tar.gz: d56e732d91259b9ebb6dc61beacc44625257a1a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b60c664a190f76360dddd09be2c8645c98ad692374f28b2f6417afaa5548565d0ddcd346a45a1e9057f8750aa98db5f5957bca7a3ad7823c1e0cea009bf1ae33
|
7
|
+
data.tar.gz: 9f66c3c77dfe4e33999858f7d22a1a34438c33f8bee65838775f6b4c05163e299174e75be56281121ed0443b03125e0ef590cba95383318f00f6018c033b0e65
|
@@ -74,12 +74,7 @@ module RspecApiDocumentation
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def query_hash
|
77
|
-
|
78
|
-
arrays = strings.map do |segment|
|
79
|
-
k,v = segment.split("=")
|
80
|
-
[k, v && CGI.unescape(v)]
|
81
|
-
end
|
82
|
-
Hash[arrays]
|
77
|
+
Rack::Utils.parse_nested_query(query_string)
|
83
78
|
end
|
84
79
|
|
85
80
|
def headers(method, path, params, request_headers)
|
@@ -79,6 +79,19 @@ module RspecApiDocumentation
|
|
79
79
|
add_setting :request_headers_to_include, :default => nil
|
80
80
|
add_setting :response_headers_to_include, :default => nil
|
81
81
|
|
82
|
+
# Change how the post body is formatted by default, you can still override by `raw_post`
|
83
|
+
# Can be :json, :xml, or a proc that will be passed the params
|
84
|
+
#
|
85
|
+
# RspecApiDocumentation.configure do |config|
|
86
|
+
# config.post_body_formatter = Proc.new do |params|
|
87
|
+
# # convert to whatever you want
|
88
|
+
# params.to_s
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# See RspecApiDocumentation::DSL::Endpoint#do_request
|
93
|
+
add_setting :post_body_formatter, :default => Proc.new { |_| Proc.new { |params| params } }
|
94
|
+
|
82
95
|
def client_method=(new_client_method)
|
83
96
|
RspecApiDocumentation::DSL::Resource.module_eval <<-RUBY
|
84
97
|
alias :#{new_client_method} #{client_method}
|
@@ -38,7 +38,19 @@ module RspecApiDocumentation::DSL
|
|
38
38
|
if method == :get && !query_string.blank?
|
39
39
|
path_or_query += "?#{query_string}"
|
40
40
|
else
|
41
|
-
|
41
|
+
formatter = RspecApiDocumentation.configuration.post_body_formatter
|
42
|
+
case formatter
|
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)
|
49
|
+
else
|
50
|
+
params_or_body = params
|
51
|
+
end
|
52
|
+
|
53
|
+
params_or_body = respond_to?(:raw_post) ? raw_post : params_or_body
|
42
54
|
end
|
43
55
|
|
44
56
|
rspec_api_documentation_client.send(method, path_or_query, params_or_body, headers)
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Cahoon
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|