soaspec 0.0.32 → 0.0.33

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: 597b71f266eacf309da4a897e8e27a3601b55bd1
4
- data.tar.gz: f5ad76b346a6dcee607d6b2976a6731ba85467c0
3
+ metadata.gz: 387fc51c51aab5fb2d1e63f026e750833b5e327c
4
+ data.tar.gz: b2c5da0da53297f1c4aec4eaefd2c6735616807f
5
5
  SHA512:
6
- metadata.gz: 0a8f3cad9b2baadf8200a1af67bd7233efbf255d2f062782912c06e22316eebf28f23a96b62b8f7bba6749a5cf636bff3c67deffba21427db6381a6396eb9f02
7
- data.tar.gz: fca37bd39cda4f3e78afa7cb25cc165ba4a8ebce3186c520f21dd97afff3031761cd8bb93d5302085b66ae10e4527e9cc278f088ec2fa0212786b86759faa63d
6
+ metadata.gz: 8dac65516d2c883b1fd110face90cc57231c588fcf2e9cebb30b6ffa09f4596dbccff8314d7f0413951330b6ba77c9d3d9cf189a2c668be44ac5aab6a78cf852
7
+ data.tar.gz: 96b1e4e8e099dd4ccff26243c95f77143a33d636ea827ea165817895640535bea4dd1e4b9ae69a29b1ea5e90b997530fb4ee34378694fd15ca88f271d7b4557c
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.0.33 / 2018-3-9
2
+ * Enhancements
3
+ * Use 'jsonpath' instead of dig to check JSON responses. Much better for finding complex paths
4
+
1
5
  Version 0.0.32 / 2018-3-9
2
6
  * Enhancements
3
7
  * Made :body key in hash that can be used to use JSON.generate for a payload when using rest_handler exchanges
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soaspec (0.0.32)
4
+ soaspec (0.0.33)
5
+ jsonpath
5
6
  rest-client (>= 2.0)
6
7
  rspec (~> 3.0)
7
8
  rspec-its (>= 1.2.0)
@@ -34,10 +35,14 @@ GEM
34
35
  socksify
35
36
  i18n (0.9.1)
36
37
  concurrent-ruby (~> 1.0)
38
+ jsonpath (0.8.11)
39
+ multi_json
40
+ to_regexp (~> 0.2.1)
37
41
  mime-types (3.1)
38
42
  mime-types-data (~> 3.2015)
39
43
  mime-types-data (3.2016.0521)
40
44
  mini_portile2 (2.3.0)
45
+ multi_json (1.13.1)
41
46
  netrc (0.11.0)
42
47
  nokogiri (1.8.1)
43
48
  mini_portile2 (~> 2.3.0)
@@ -83,6 +88,7 @@ GEM
83
88
  nori (~> 2.4)
84
89
  wasabi (~> 3.4)
85
90
  socksify (1.7.1)
91
+ to_regexp (0.2.1)
86
92
  unf (0.1.4)
87
93
  unf_ext
88
94
  unf_ext (0.0.7.4)
@@ -6,6 +6,7 @@ require 'rspec/its'
6
6
  require 'savon' # SOAP
7
7
  require 'nokogiri' # XPath
8
8
  require 'date'
9
+ require 'jsonpath'
9
10
 
10
11
  require 'soaspec/version'
11
12
  require 'soaspec/exchange_handlers/soap_handler'
@@ -5,6 +5,7 @@ require_relative '../not_found_errors'
5
5
  require_relative '../accessors'
6
6
  require_relative '../interpreter'
7
7
  require 'json'
8
+ require 'jsonpath'
8
9
  require 'nori'
9
10
 
10
11
  module Soaspec
@@ -179,10 +180,9 @@ module Soaspec
179
180
  path = '//' + path if path[0] != '/'
180
181
  xpath_value_for(exchange: exchange, xpath: path)
181
182
  when :json
182
- hash = extract_hash exchange.response
183
- value = hash.dig(*path)
184
- raise NoElementInHash, "Element in #{hash} not found with path '#{path}'" unless value
185
- value
183
+ matching_values = JsonPath.on(exchange.response.body, path)
184
+ raise NoElementInHash, "Element in #{exchange.response.body} not found with path '#{path}'" if matching_values.empty?
185
+ matching_values.first
186
186
  else
187
187
  raise 'Unrecognised response message. Neither xml nor json detected'
188
188
  end
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.32'
2
+ VERSION = '0.0.33'
3
3
  end
@@ -25,6 +25,7 @@ the same configuration }
25
25
  spec.add_development_dependency 'bundler', '~> 1.16'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
27
27
  spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_dependency 'jsonpath'
28
29
  spec.add_dependency 'rest-client', '>= 2.0' # REST
29
30
  spec.add_dependency 'rspec', '~> 3.0' # This framework is designed to work with RSpec
30
31
  spec.add_dependency 'rspec-its', '>= 1.2.0'
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.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jsonpath
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rest-client
57
71
  requirement: !ruby/object:Gem::Requirement