soaspec 0.0.58 → 0.0.59
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/.gitlab-ci.yml +1 -1
- data/.rspec +1 -1
- data/ChangeLog +5 -0
- data/Rakefile +2 -10
- data/exe/soaspec-virtual-server +4 -0
- data/lib/soaspec/exchange_handlers/rest_handler.rb +26 -41
- data/lib/soaspec/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: 00575bd80732286d4db1c5bf9fd94768e1b32125
|
4
|
+
data.tar.gz: b5e4e7469fe387aa0264c0dec836a7ebcb8ac7aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47cc6b1be05516b7571f4a7e34f3edd9b6f950c382e3c99024e3b6a36e34b9df50ce5484119155af1ad8625ae15036bb152843d4cb59db941a9e168eaeef3ba1
|
7
|
+
data.tar.gz: 9ad7763688e267213c26d9a1e7ed0c37b6d4deadcce979cd7ceed37dec6d86206d3e788ca85cb08cce0e6cb8c5105d6ac8ac913722179714a8bc1bfa8b997e77
|
data/.gitlab-ci.yml
CHANGED
data/.rspec
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Version 0.0.59
|
2
|
+
* Enhancements
|
3
|
+
* Perform ERB in headers to make using access_token using 'headers' possible
|
4
|
+
* Try better way of testing `soaspec-init`.
|
5
|
+
|
1
6
|
Version 0.0.58
|
2
7
|
* Enhancements
|
3
8
|
* Add method to set parts of the request body through `exchange[key]= 'value'`
|
data/Rakefile
CHANGED
@@ -6,19 +6,11 @@ ENV['folder'] ||= ''
|
|
6
6
|
ENV['test'] ||= ''
|
7
7
|
|
8
8
|
RSpec::Core::RakeTask.new(:run_spec) do |t|
|
9
|
-
t.pattern = "
|
9
|
+
t.pattern = "spec/**/#{ENV['folder']}*/#{ENV['test']}*_spec.rb"
|
10
10
|
end
|
11
11
|
|
12
|
-
desc 'Use soaspec_init in tmp to generate test files. Used for verifying it'
|
13
|
-
task :use_soaspec_init do
|
14
|
-
mkdir_p 'tmp'
|
15
|
-
mkdir_p 'tmp/init'
|
16
|
-
puts `cd tmp/init && ruby ../../exe/soaspec-init`
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
12
|
desc 'Run tests'
|
21
|
-
task spec: %w[clean clobber
|
13
|
+
task spec: %w[clean clobber start_test_server run_spec]
|
22
14
|
|
23
15
|
task default: :spec
|
24
16
|
|
data/exe/soaspec-virtual-server
CHANGED
@@ -25,46 +25,26 @@ module Soaspec
|
|
25
25
|
# Will create access_token method based on passed parameters
|
26
26
|
def oauth2(client_id: nil, client_secret: nil, token_url: nil, username: nil, password: nil, security_token: nil)
|
27
27
|
define_method('oauth_response') do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
client_secret: client_secret,
|
49
|
-
username: username,
|
50
|
-
password: password,
|
51
|
-
multipart: true
|
52
|
-
},
|
53
|
-
cache_control: 'no_cache',
|
54
|
-
verify_ssl: false
|
55
|
-
)
|
56
|
-
else
|
57
|
-
RestClient.post(
|
58
|
-
token_url,
|
59
|
-
{
|
60
|
-
grant_type: 'client_credentials',
|
61
|
-
client_id: client_id,
|
62
|
-
client_secret: client_secret
|
63
|
-
},
|
64
|
-
cache_control: 'no_cache',
|
65
|
-
verify_ssl: false
|
66
|
-
)
|
67
|
-
end
|
28
|
+
payload = if password && username
|
29
|
+
{
|
30
|
+
grant_type: 'password',
|
31
|
+
client_id: client_id,
|
32
|
+
client_secret: client_secret,
|
33
|
+
username: username,
|
34
|
+
password: security_token ? (password + security_token) : password,
|
35
|
+
multipart: true
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
grant_type: 'client_credentials',
|
40
|
+
client_id: client_id,
|
41
|
+
client_secret: client_secret
|
42
|
+
}
|
43
|
+
end
|
44
|
+
response = RestClient.post(token_url, payload, cache_control: 'no_cache', verify_ssl: false)
|
45
|
+
Soaspec::SpecLogger.add_to 'request_params: ' + payload.to_s
|
46
|
+
Soaspec::SpecLogger.add_to('response_headers: ' + response.headers.to_s)
|
47
|
+
Soaspec::SpecLogger.add_to('response_body: ' + response.to_s)
|
68
48
|
JSON.parse(response)
|
69
49
|
end
|
70
50
|
|
@@ -123,6 +103,11 @@ module Soaspec
|
|
123
103
|
}
|
124
104
|
end
|
125
105
|
|
106
|
+
def parse_headers
|
107
|
+
# rest_client_headers.map { |h| ERB.new(h).result(binding) }
|
108
|
+
Hash[rest_client_headers.map { |k, header| [k, ERB.new(header).result(binding)] }]
|
109
|
+
end
|
110
|
+
|
126
111
|
# Setup object to handle communicating with a particular SOAP WSDL
|
127
112
|
# @param [Hash] options Options defining SOAP request. WSDL, authentication
|
128
113
|
def initialize(name = self.class.to_s, options = {})
|
@@ -136,7 +121,7 @@ module Soaspec
|
|
136
121
|
set_remove_key(options, :default_hash)
|
137
122
|
merged_options = rest_resource_options
|
138
123
|
merged_options[:headers] ||= {}
|
139
|
-
merged_options[:headers].merge!
|
124
|
+
merged_options[:headers].merge! parse_headers
|
140
125
|
merged_options.merge!(options)
|
141
126
|
@resource = RestClient::Resource.new(base_url_value, merged_options) # @resource[url_extension].get
|
142
127
|
end
|
data/lib/soaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|