soap_client 0.3.0 → 1.0.0
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/.travis.yml +2 -2
- data/CHANGELOG.md +7 -0
- data/lib/soap_client.rb +2 -0
- data/lib/soap_client/client.rb +12 -8
- data/lib/soap_client/services/build_savon_attrs.rb +2 -5
- data/lib/soap_client/services/log_xml.rb +37 -0
- data/lib/soap_client/version.rb +1 -1
- data/soap_client.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6921d4eddc29acca3c63b76090ddc4f5aec4ef39
|
4
|
+
data.tar.gz: 1c37d3d7cfe85008dcf9aaa9682a3381674c829c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6104261d88536b56da7f9180182ace404a9129ad9de01b1d77790b381dfcd0eab1cb5fc17a21eb323909d19ac77a5258ed989f7657f150d2d2ec2b3038bbab5e
|
7
|
+
data.tar.gz: 6d14e1eb08c29f11d685132a1398f19790a438a67dd94302b6c2032456e5a0a34bb6ca823f5eb06f4792d6756fda54c7ae965e6e90a97e181458ad5bc1e456af
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [1.0.0]
|
7
|
+
### Changed
|
8
|
+
- Pass scrub directives (of [XMLScrubber](https://github.com/imacchiato/xml_scrubber)) and `log: true` to log request and response XML
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Logging sensitive information. Remove old way of relying on passing a logger that knew how to scrub
|
12
|
+
|
6
13
|
## [0.3.0] - 2017-02-13
|
7
14
|
### Added
|
8
15
|
- Log in the info level, the request and response XMLs if logging is enabled
|
data/lib/soap_client.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "virtus"
|
2
2
|
require "savon"
|
3
|
+
require "xml_scrubber"
|
3
4
|
require "active_support/core_ext/hash/slice"
|
4
5
|
require "active_support/core_ext/object/blank"
|
5
6
|
require "soap_client/version"
|
6
7
|
require "soap_client/client"
|
7
8
|
require "soap_client/services/build_savon_attrs"
|
9
|
+
require "soap_client/services/log_xml"
|
8
10
|
|
9
11
|
module SOAPClient
|
10
12
|
|
data/lib/soap_client/client.rb
CHANGED
@@ -11,6 +11,7 @@ module SOAPClient
|
|
11
11
|
attribute :proxy, String
|
12
12
|
attribute :open_timeout, Integer
|
13
13
|
attribute :read_timeout, Integer
|
14
|
+
attribute :scrub, Array[Hash]
|
14
15
|
|
15
16
|
def self.call(*args)
|
16
17
|
self.new(*args).()
|
@@ -18,21 +19,24 @@ module SOAPClient
|
|
18
19
|
|
19
20
|
def call
|
20
21
|
if log
|
21
|
-
|
22
|
-
logger.info "Request XML: #{savon_request.body}"
|
22
|
+
LogXML.(logger, soap_request.body, soap_response.xml, scrub)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
soap_response
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
+
private
|
28
29
|
|
29
|
-
|
30
|
+
def soap_request
|
31
|
+
@soap_request ||= soap_client.build_request(action, message: message)
|
30
32
|
end
|
31
33
|
|
32
|
-
|
34
|
+
def soap_response
|
35
|
+
@soap_response ||= soap_client.(action, message: message)
|
36
|
+
end
|
33
37
|
|
34
|
-
def
|
35
|
-
@
|
38
|
+
def soap_client
|
39
|
+
@soap_client ||= Savon.client(savon_attrs)
|
36
40
|
end
|
37
41
|
|
38
42
|
def savon_attrs
|
@@ -2,12 +2,9 @@ module SOAPClient
|
|
2
2
|
class BuildSavonAttrs
|
3
3
|
|
4
4
|
def self.call(raw_attrs)
|
5
|
-
attrs = raw_attrs.slice(
|
6
|
-
:wsdl,
|
7
|
-
:log,
|
8
|
-
:logger,
|
9
|
-
)
|
5
|
+
attrs = raw_attrs.slice(:wsdl)
|
10
6
|
attrs[:proxy] = raw_attrs[:proxy] if raw_attrs[:proxy].present?
|
7
|
+
attrs[:log] = false
|
11
8
|
attrs
|
12
9
|
end
|
13
10
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SOAPClient
|
2
|
+
class LogXML
|
3
|
+
|
4
|
+
def self.call(*args)
|
5
|
+
self.new(*args).()
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(logger, request_xml, response_xml, scrub_directives)
|
9
|
+
@logger = logger
|
10
|
+
@request_xml = request_xml
|
11
|
+
@response_xml = response_xml
|
12
|
+
@scrub_directives = scrub_directives
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
@logger.info(log_text)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def log_text
|
22
|
+
[
|
23
|
+
"Request XML: #{scrubbed_request_xml}",
|
24
|
+
"Response XML: #{scrubbed_response_xml}",
|
25
|
+
].join("\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
def scrubbed_request_xml
|
29
|
+
@scrubbed_request_xml ||= XMLScrubber.(@request_xml, @scrub_directives)
|
30
|
+
end
|
31
|
+
|
32
|
+
def scrubbed_response_xml
|
33
|
+
@scrubbed_response_xml ||= XMLScrubber.(@response_xml, @scrub_directives)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/soap_client/version.rb
CHANGED
data/soap_client.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "virtus", "~> 1.0"
|
30
30
|
spec.add_dependency "savon", "~> 2.0"
|
31
31
|
spec.add_dependency "activesupport", ">= 3.0"
|
32
|
+
spec.add_dependency "xml_scrubber", "~> 1.0"
|
32
33
|
|
33
34
|
spec.add_development_dependency "bundler", "~> 1.11"
|
34
35
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soap_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
@@ -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: xml_scrubber
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +129,7 @@ files:
|
|
115
129
|
- lib/soap_client.rb
|
116
130
|
- lib/soap_client/client.rb
|
117
131
|
- lib/soap_client/services/build_savon_attrs.rb
|
132
|
+
- lib/soap_client/services/log_xml.rb
|
118
133
|
- lib/soap_client/version.rb
|
119
134
|
- soap_client.gemspec
|
120
135
|
homepage: https://github.com/imacchiato/soap_client
|