soap_client 0.2.0 → 0.3.0

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: bfc71cbed4b3c74dae034d4929376fb143aa9423
4
- data.tar.gz: d7ffbcaed35fb41716b9be6c90d9149e5ff2bf85
3
+ metadata.gz: 3dac54722a44857206aebfbf763b504a8836592a
4
+ data.tar.gz: 6b85d4ec4fc05ed41e94cafad39578867902b2ee
5
5
  SHA512:
6
- metadata.gz: e82fee7ac80b9f5981e337e5b19f8b6f190b65638c694c4982b0a9843fd8ed59884bf2c6e44f075e164ab19f6562058c8af9ec36ae02811f109cdaf0776afe4d
7
- data.tar.gz: b141fd325ff9d40d0316c47414ce74448cd46bae3c9c2dd81d7c86c133d194dba874be08eeffe00047d93b7ac74dbd955174391afd60c78f949d95a9b52b8904
6
+ metadata.gz: 01b9f4db9cb19eb5e2111b62a37136de857288b259fca3f2a71b911016c652d15ce0410d34b03228c9f6b4bca57004f33629a6e37d51fe70a6370b75e0086c42
7
+ data.tar.gz: e7db22f841d7bcbc3257f2cdde12edbe2f5210fc6fe27dd246090d5e65124fbde839d8fac2e33cbbe004b0ef651a829ede055aba2f16e047738a5314ed1f8e53
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
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
+ ## [0.3.0] - 2017-02-13
7
+ ### Added
8
+ - Log in the info level, the request and response XMLs if logging is enabled
9
+ - Logger logs to STDOUT by default
10
+
6
11
  ## [0.2.0] - 2016-03-09
7
12
  ### Added
8
13
  - `read_timeout` and `open_timeout` to set the timeout values, in seconds, to the SOAP client
@@ -6,7 +6,7 @@ module SOAPClient
6
6
  attribute :action, Symbol
7
7
  attribute :message, Hash
8
8
  attribute :wsdl, String
9
- attribute :logger
9
+ attribute :logger, Object, lazy: true, default: :default_logger
10
10
  attribute :log, Boolean, default: false
11
11
  attribute :proxy, String
12
12
  attribute :open_timeout, Integer
@@ -17,23 +17,30 @@ module SOAPClient
17
17
  end
18
18
 
19
19
  def call
20
- savon_client.call(action, message: message)
20
+ if log
21
+ savon_request = savon_client.build_request(action, message: message)
22
+ logger.info "Request XML: #{savon_request.body}"
23
+ end
24
+
25
+ savon_response = savon_client.call(action, message: message)
26
+
27
+ logger.info("Response XML: #{savon_response.xml}") if log
28
+
29
+ savon_response
21
30
  end
22
31
 
23
32
  private
24
33
 
25
34
  def savon_client
26
- @savon_client ||= Savon.client(savon_attributes)
35
+ @savon_client ||= Savon.client(savon_attrs)
36
+ end
37
+
38
+ def savon_attrs
39
+ BuildSavonAttrs.(attributes)
27
40
  end
28
41
 
29
- def savon_attributes
30
- attrs = attributes.slice(
31
- :wsdl,
32
- :log,
33
- :logger,
34
- )
35
- attrs[:proxy] = proxy if proxy.present?
36
- attrs
42
+ def default_logger
43
+ Logger.new(STDOUT)
37
44
  end
38
45
 
39
46
  end
@@ -0,0 +1,15 @@
1
+ module SOAPClient
2
+ class BuildSavonAttrs
3
+
4
+ def self.call(raw_attrs)
5
+ attrs = raw_attrs.slice(
6
+ :wsdl,
7
+ :log,
8
+ :logger,
9
+ )
10
+ attrs[:proxy] = raw_attrs[:proxy] if raw_attrs[:proxy].present?
11
+ attrs
12
+ end
13
+
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module SOAPClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/soap_client.rb CHANGED
@@ -4,6 +4,7 @@ require "active_support/core_ext/hash/slice"
4
4
  require "active_support/core_ext/object/blank"
5
5
  require "soap_client/version"
6
6
  require "soap_client/client"
7
+ require "soap_client/services/build_savon_attrs"
7
8
 
8
9
  module SOAPClient
9
10
 
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.2.0
4
+ version: 0.3.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: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2017-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -114,6 +114,7 @@ files:
114
114
  - bin/setup
115
115
  - lib/soap_client.rb
116
116
  - lib/soap_client/client.rb
117
+ - lib/soap_client/services/build_savon_attrs.rb
117
118
  - lib/soap_client/version.rb
118
119
  - soap_client.gemspec
119
120
  homepage: https://github.com/imacchiato/soap_client
@@ -137,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  version: '0'
138
139
  requirements: []
139
140
  rubyforge_project:
140
- rubygems_version: 2.4.6
141
+ rubygems_version: 2.5.1
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: Wrapper around SOAP clients (starts with Savon).