soaspec 0.0.58 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ae8790fbb996c10af64623bea6e7be9e6372b1
4
- data.tar.gz: ff46acc85fb7aceae9079a033d659f93b3dd3798
3
+ metadata.gz: 00575bd80732286d4db1c5bf9fd94768e1b32125
4
+ data.tar.gz: b5e4e7469fe387aa0264c0dec836a7ebcb8ac7aa
5
5
  SHA512:
6
- metadata.gz: e1e699420cd01b427c8259c8404ac3d53385d304e32767b4b20385fdde13d72ccad836055f0073712745e6a99aeb323faf5700118f0bd106fe23fdf904f4c7d7
7
- data.tar.gz: d1eadfde7e77d7dc43dd3819fb73cfed1e2eced1d4ded41bcd16813115769fc82beebe2716901413896d416e8a2253d80b0b3e09e7240c0ce95ecaf824a02164
6
+ metadata.gz: 47cc6b1be05516b7571f4a7e34f3edd9b6f950c382e3c99024e3b6a36e34b9df50ce5484119155af1ad8625ae15036bb152843d4cb59db941a9e168eaeef3ba1
7
+ data.tar.gz: 9ad7763688e267213c26d9a1e7ed0c37b6d4deadcce979cd7ceed37dec6d86206d3e788ca85cb08cce0e6cb8c5105d6ac8ac913722179714a8bc1bfa8b997e77
data/.gitlab-ci.yml CHANGED
@@ -14,7 +14,7 @@ rspec:
14
14
  - coverage/
15
15
 
16
16
  cucumber:
17
- stage: acceptance
17
+ stage: test
18
18
  script:
19
19
  - bundle exec cucumber
20
20
 
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
+ --require spec_helper
1
2
  --format documentation
2
3
  --color
3
- --require spec_helper
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 = "{spec/*/#{ENV['folder']}*/,tmp/*/spec/}#{ENV['test']}*_spec.rb"
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 use_soaspec_init start_test_server run_spec]
13
+ task spec: %w[clean clobber start_test_server run_spec]
22
14
 
23
15
  task default: :spec
24
16
 
@@ -27,6 +27,10 @@ get '/BLZService' do
27
27
  [200, { 'Content-Type' => 'text/xml' }, Soaspec::TestServer::GetBank.test_wsdl]
28
28
  end
29
29
 
30
+ get '/as/token.oauth2' do
31
+
32
+ end
33
+
30
34
  # Used for testing storage of data
31
35
  post '/test/id' do
32
36
  # puts request.body.string
@@ -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
- response = if password && username && security_token
29
- RestClient.post(
30
- token_url,
31
- {
32
- grant_type: 'password',
33
- client_id: client_id,
34
- client_secret: client_secret,
35
- username: username,
36
- password: (password + security_token),
37
- multipart: true
38
- },
39
- cache_control: 'no_cache',
40
- verify_ssl: false
41
- )
42
- elsif password && username
43
- RestClient.post(
44
- token_url,
45
- {
46
- grant_type: 'password',
47
- client_id: client_id,
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! rest_client_headers
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
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.58'.freeze
2
+ VERSION = '0.0.59'.freeze
3
3
  end
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.58
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-18 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler