soaspec 0.3.10 → 0.3.11

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
  SHA256:
3
- metadata.gz: 8a68172ce21318f8672a99f1495ebbce59fecc4617e0e3bc91505658fab127dd
4
- data.tar.gz: 7f6aa9f1a6850a8733220ab1e0443b247b2edea75f4fcdd2d96d74b9a8c8d51d
3
+ metadata.gz: ff535556597fbdc9006d5e9482e5fd835edfb39c76a9607cb7d5c05fae6291ca
4
+ data.tar.gz: af6b528b564ec301a9cb80ede31bc8edaaeabccb594cb7cb85949c0057e29b7e
5
5
  SHA512:
6
- metadata.gz: 751fbd2a339bdc59490befd592becc2319dd7ca165f6887f8640d8fb6e1cbe87b224a235b0dce0cbc4bad255048ad2d8d320895926846199b9fd66b00cf82681
7
- data.tar.gz: fa62bc0cc31a907168583dbd09dda939f3e3f000c420044e45a34a2cadeef19b9c81abd42451c9d25dc1347b298404fa8f18c01cb289b28dde14e8644f9005aa
6
+ metadata.gz: 6c53fdf6578f58b9625a46cb85928e13ee566f9bffc1778f0edf5365d50196c239adf847df72a9e38a0fa1f6d5e775b3706e21d042be21504049015586aa0ce9
7
+ data.tar.gz: 27e48e5546ec9ccdcbc72fd958a8c4255c87f2ce71a288aa01a5b7299315ea6cde4e19bcba6fa2183872d78e7a5f23bc4ca15be4d62a1b4d2656a16bb7b46cfe
@@ -1,33 +1,33 @@
1
- image: ruby:2.5
1
+ image: ruby:2.6
2
2
 
3
- before_script:
4
- - ruby -v
5
- - which ruby
6
- - gem install bundler rake
7
- - bundle install --jobs $(nproc) --path vendor # Install dependencies into ./vendor/ruby
3
+ include:
4
+ - template: Code-Quality.gitlab-ci.yml
8
5
 
9
6
  cache:
10
7
  key: ${CI_COMMIT_REF_SLUG}
11
8
  paths:
12
9
  - vendor/ruby
13
10
 
11
+ .ruby_test: &ruby_test
12
+ script:
13
+ - gem install bundler rake
14
+ - bundle install --jobs $(nproc) --path vendor # Install dependencies into ./vendor/ruby
15
+ - bundle exec rake
16
+
14
17
  ruby_2.3:
15
18
  stage: test
16
19
  image: ruby:2.3
17
- script:
18
- - bundle exec rake
20
+ <<: *ruby_test
19
21
 
20
22
  ruby_2.4:
21
23
  stage: test
22
24
  image: ruby:2.4
23
- script:
24
- - bundle exec rake
25
+ <<: *ruby_test
25
26
 
26
27
  ruby_2.5:
27
28
  stage: test
28
29
  image: ruby:2.5
29
- script:
30
- - bundle exec rake
30
+ <<: *ruby_test
31
31
  artifacts:
32
32
  paths:
33
33
  - coverage/
@@ -35,25 +35,28 @@ ruby_2.5:
35
35
  ruby_2.6:
36
36
  stage: test
37
37
  image: ruby:2.6
38
- script:
39
- - bundle exec rake
38
+ <<: *ruby_test
40
39
 
41
40
  cucumber:
42
41
  image: samuelgarratt/soaspec
43
42
  stage: test
44
43
  script:
44
+ - gem install bundler
45
+ - bundle install
45
46
  - bundle exec cucumber
46
47
 
47
48
  doctest:
48
49
  image: samuelgarratt/soaspec
49
50
  stage: test
50
51
  script:
52
+ - gem install bundler
53
+ - bundle install
51
54
  - bundle exec rake yard:doctest
52
55
 
53
56
  pages:
54
57
  stage: deploy
55
58
  dependencies:
56
- - ruby_2.5
59
+ - ruby_2.6
57
60
  script:
58
61
  - mv demo/ public/
59
62
  - mv coverage/ public/coverage
@@ -1,2 +1,12 @@
1
- Metrics/LineLength:
1
+ Layout/LineLength:
2
2
  Max: 154
3
+ Lint/RaiseException:
4
+ Enabled: true
5
+ Lint/StructNewOverride:
6
+ Enabled: true
7
+ Style/HashEachMethods:
8
+ Enabled: true
9
+ Style/HashTransformKeys:
10
+ Enabled: true
11
+ Style/HashTransformValues:
12
+ Enabled: true
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.3.11
2
+ * Enhancement
3
+ * Add 'resource' parameter to OAuth2 options
4
+
1
5
  Version 0.3.10
2
6
  * Enhancement
3
7
  * Create `body_params` method on RestRequest object to return Hash of parameters used to form request body
@@ -164,7 +164,7 @@ module Soaspec
164
164
  def concat_urls(url, suburl)
165
165
  url = url.to_s
166
166
  suburl = suburl.to_s
167
- if url.slice(-1, 1) == '/' or suburl.slice(0, 1) == '/'
167
+ if (url.slice(-1, 1) == '/') || (suburl.slice(0, 1) == '/')
168
168
  url + suburl
169
169
  else
170
170
  "#{url}/#{suburl}"
@@ -203,7 +203,7 @@ module Soaspec
203
203
  raise NoElementAtPath, "No value at Xpath '#{prefix_xpath(path, attribute)}' in '#{response.body}'" unless result
204
204
  return result.inner_text if attribute.nil?
205
205
 
206
- return result.attributes[attribute].inner_text
206
+ result.attributes[attribute].inner_text
207
207
  when :json
208
208
  matching_values = calculated_json_path_matches(path, response, attribute, not_empty: true)
209
209
  matching_values.first
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Soaspec
3
4
  # Default values set in order to make testing easier. Override to fit what you
4
5
  # need in testing
@@ -22,4 +23,4 @@ module Soaspec
22
23
  end
23
24
  end
24
25
  end
25
- end
26
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Soaspec
2
4
  # Singleton methods for assigning Savon globals (http://savonrb.com/version2/globals.html)
3
5
  module SoapGlobals
@@ -55,6 +55,7 @@ module Soaspec
55
55
  # @option params_sent [client_secret] Client Secret
56
56
  # @option params_sent [username] Username used in password grant
57
57
  # @option params_sent [password] Password used in password grant
58
+ # @option params_sent [resource] Api server that handles authenticated requests
58
59
  # @option params_sent [security_token] Security Token used in password grant
59
60
  # @param [String] api_username Username to use which can be set by Soaspec::ExchangeHandler
60
61
  def initialize(params_sent, api_username = nil)
@@ -129,18 +130,24 @@ module Soaspec
129
130
  # @return [Hash] Payload for retrieving OAuth access token
130
131
  def payload
131
132
  payload = { client_id: params[:client_id], client_secret: params[:client_secret] }
132
- payload.merge(if params[:password] && params[:username]
133
- {
134
- grant_type: 'password', username: params[:username],
135
- password: password
136
- }.merge multipart true
137
- else
138
- { grant_type: 'client_credentials' }.merge multipart false
139
- end)
133
+ payload.merge!(if params[:password] && params[:username]
134
+ password_grant_type_params
135
+ else
136
+ { grant_type: 'client_credentials' }.merge multipart false
137
+ end)
138
+ payload[:resource] = params[:resource] if params[:resource]
139
+ payload
140
140
  end
141
141
 
142
142
  private
143
143
 
144
+ def password_grant_type_params
145
+ {
146
+ grant_type: 'password', username: params[:username],
147
+ password: password
148
+ }.merge multipart true
149
+ end
150
+
144
151
  # @param [Boolean] default Default value for multipart
145
152
  # @return [Hash] Multipart set to true if not set and is grant_type password
146
153
  def multipart(default)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Soaspec
4
4
  # @return [String] Version of the gem
5
- VERSION = '0.3.10'
5
+ VERSION = '0.3.11'
6
6
  end
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = "Helps to create tests for 'SOAP' or 'REST' apis. Easily represent multiple requests with
15
15
  the same configuration. Examples designed for RSpec and Cucumber."
16
16
  spec.homepage = 'https://gitlab.com/samuel-garratt/soaspec'
17
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
17
18
  spec.license = 'MIT'
18
19
 
19
20
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -22,7 +23,6 @@ the same configuration. Examples designed for RSpec and Cucumber."
22
23
  spec.bindir = 'exe'
23
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
25
  spec.require_paths = ['lib']
25
- spec.required_ruby_version = '>= 2.3.0'
26
26
 
27
27
  spec.add_development_dependency 'bundler'
28
28
  spec.add_development_dependency 'cucumber'
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.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler