soaspec 0.0.63 → 0.0.64
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/ChangeLog +6 -0
- data/lib/soaspec/exchange.rb +20 -2
- data/lib/soaspec/exchange_handlers/rest_handler.rb +4 -2
- data/lib/soaspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c86df1d3a144dc27e77be77a31c9b4391fd07a
|
4
|
+
data.tar.gz: 9fae1931ca918a24b6d44e7a7539225d79d829ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f876e1f3e3e532e9c4dd0bc65cc16e50da035d165a9d712add298c4221a61cd3808c9f13a779658543d22c2339060af88ee4bedb01b01df93a44e1982c1b665
|
7
|
+
data.tar.gz: 9e913c8ded49a9df53a65ae78a9e3672e725486f755c562ea3610e092a301ce773e8a217143e0cda0d21dc7e498a0236e5cc5e72355ead42853130f6b111c1e1
|
data/ChangeLog
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
Version 0.0.64
|
2
|
+
* Enhancements
|
3
|
+
* Got FactoryBot working for RestHandler. See specs for example
|
4
|
+
* Add element? method to exchange to make it easier to check element is at path
|
5
|
+
* Define 'element_name?' created when element is defined on ExchangeHandler
|
6
|
+
|
1
7
|
Version 0.0.63
|
2
8
|
* Enhancements
|
3
9
|
* Interpret ERB for oauth credentials within oauth response. Needed for when params like 'username' can change in runtime
|
data/lib/soaspec/exchange.rb
CHANGED
@@ -33,15 +33,25 @@ class Exchange
|
|
33
33
|
@retry_for_success = false
|
34
34
|
self.retry_count = 3
|
35
35
|
@api_class.elements.each do |element|
|
36
|
-
|
36
|
+
element_name = element.to_s.split('__custom_path_').last
|
37
|
+
define_singleton_method(element_name) do
|
37
38
|
@api_class.__send__(element, response) # Forward the call onto handler to retrieve the element for the response
|
38
39
|
end
|
40
|
+
define_singleton_method("#{element_name}?") do
|
41
|
+
begin
|
42
|
+
__send__ element_name
|
43
|
+
true
|
44
|
+
rescue NoElementAtPath
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
42
51
|
# Merge exchange initialized request params with ones set later on
|
43
52
|
def merge_request_body
|
44
|
-
if @override_parameters[:body]
|
53
|
+
if @override_parameters[:body] || default_params[:body]
|
54
|
+
@override_parameters[:body] ||= {}
|
45
55
|
@override_parameters[:body].merge!(default_params[:body])
|
46
56
|
@override_parameters
|
47
57
|
else
|
@@ -113,6 +123,14 @@ class Exchange
|
|
113
123
|
true
|
114
124
|
end
|
115
125
|
|
126
|
+
# @return [Boolean] Whether an element exists at the path
|
127
|
+
def element?(path)
|
128
|
+
[path]
|
129
|
+
true
|
130
|
+
rescue NoElementAtPath
|
131
|
+
false
|
132
|
+
end
|
133
|
+
|
116
134
|
# Extract value from path api class
|
117
135
|
# @param [Object] path Path to return element for api class E.g - for SOAP this is XPath string. For JSON, this is Hash dig Array
|
118
136
|
# @return [String] Value at path
|
@@ -114,8 +114,9 @@ module Soaspec
|
|
114
114
|
}
|
115
115
|
end
|
116
116
|
|
117
|
+
# Perform ERB on each header value
|
118
|
+
# @return [Hash] Hash from 'rest_client_headers' passed through ERB
|
117
119
|
def parse_headers
|
118
|
-
# rest_client_headers.map { |h| ERB.new(h).result(binding) }
|
119
120
|
Hash[rest_client_headers.map { |k, header| [k, ERB.new(header).result(binding)] }]
|
120
121
|
end
|
121
122
|
|
@@ -140,11 +141,12 @@ module Soaspec
|
|
140
141
|
# Used in together with Exchange request that passes such override parameters
|
141
142
|
# @param [Hash] override_parameters Params to characterize REST request
|
142
143
|
# @param_value [params] Extra parameters (E.g. headers)
|
143
|
-
# @param_value [suburl] URL appended to base_url of
|
144
|
+
# @param_value [suburl] URL appended to base_url of class
|
144
145
|
# @param_value [method] REST method (get, post, etc)
|
145
146
|
def make_request(override_parameters)
|
146
147
|
test_values = override_parameters
|
147
148
|
test_values[:params] ||= {}
|
149
|
+
test_values[:method] ||= :post
|
148
150
|
test_values[:suburl] = test_values[:suburl].to_s if test_values[:suburl]
|
149
151
|
test_values[:params][:params] = test_values[:q] if test_values[:q] # Use q for query parameters. Nested :params is ugly and long
|
150
152
|
|
data/lib/soaspec/version.rb
CHANGED