royal_mail_api 0.1.0 → 0.1.1

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: c01736c6d05427c31f7f0d6f02f8a1ec05df6119
4
- data.tar.gz: e3a2d198094f97b39ca060a8fe23dbb2db5e3541
3
+ metadata.gz: d2c6e86851f5017f8d8aae2a07447baee4714f3f
4
+ data.tar.gz: f05530039d48ee13792723ab0a83fa90e42cbb23
5
5
  SHA512:
6
- metadata.gz: 6c055ad3497eec87ef76a46dc0c6c99f1fd4f5b217d80a341ae2bce54c52bd0f5bddf0627c1323a6fd17d73b1659c508adac2d641f04680bf6aa63008a31950d
7
- data.tar.gz: 7f894303cda4f209982b97d7ef9289aa582e65aca1efd7d2538b1e2a74b063bf68e173f093c8fb554b08cd45b1bf2a25454f79e0658ce3f36c4bd68a506d7259
6
+ metadata.gz: 3ed4a6db723fe0eb803f4e6fdf9bd6708188f1134e3bc9a3b02e8f2435d40d171a9ae105d9b8b4ed285279a1c0fc30dac48db0bb203e65240e83fd04fb001f50
7
+ data.tar.gz: b7bbcde204e3e8979e95623802f138984700dfa209a12a723c1c9135998d6444dfb99d052feaf3c6599c4e6de9e7c62a93c9e608d33eb5faa180653bbccce748
data/README.md CHANGED
@@ -35,6 +35,7 @@ in initializers/royal_mail_api.rb
35
35
  config.ssl_cert_file = 'path to your Royal Mail cert file'
36
36
  config.ssl_cert_key_file = 'path to your Royal Mail key file'
37
37
  config.endpoint = api endpoint for sandbox/production (eg. "https://api.royalmail.com/shipping/onboarding")
38
+ config.logger = Logger.new(STDOUT)
38
39
  end
39
40
  ```
40
41
 
@@ -8,7 +8,8 @@ module RoyalMailApi
8
8
  :ssl_cert_file,
9
9
  :ssl_cert_key_file,
10
10
  :endpoint,
11
- :application_id
11
+ :application_id,
12
+ :logger
12
13
 
13
14
  end
14
15
  end
@@ -3,8 +3,12 @@ module RoyalMailApi
3
3
  class << self
4
4
  def request(request, attrs={})
5
5
  begin
6
- savon.call(request, xml: build_xml(attrs))
6
+ xml = build_xml(attrs)
7
+ config.logger.info("CREATE SHIPMENT REQUEST: #{xml}")
8
+ savon.call(request, xml: xml)
7
9
  rescue Savon::SOAPFault => e
10
+ config.logger.error("CREATE SHIPMENT ERROR #{e.http.code}")
11
+ config.logger.error("ERROR XML: #{e.xml}")
8
12
  raise RoyalMailApi::SoapError.new({
9
13
  xml: e.xml,
10
14
  error_code: e.http.code
@@ -1,3 +1,3 @@
1
1
  module RoyalMailApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -14,6 +14,11 @@ class XmlBuilder < OpenStruct
14
14
 
15
15
  def initialize(request, attrs={})
16
16
  @request = request
17
+
18
+ attrs = attrs.reduce({}) do |hash,(k,v)|
19
+ hash[k]=parse_special_characters(v); hash
20
+ end
21
+
17
22
  super attrs
18
23
  end
19
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: royal_mail_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Srikanth Kunkulagunta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-21 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon