debitech_soap 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.5
2
+
3
+ Added timeout handling. Timeouts now return 403 so that you can retry.
4
+
1
5
  0.0.4
2
6
 
3
7
  Ruby 1.9 compability. Support for both the standard library soap implementation and soap4r.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- debitech_soap (0.0.4)
4
+ debitech_soap (0.0.5)
5
5
  mumboe-soap4r (~> 1.5.8.4)
6
6
 
7
7
  GEM
@@ -46,7 +46,6 @@ Gotchas
46
46
 
47
47
  - We have only used the following methods in production: askIf3DSEnrolled, authorize3DS, authorize, subscribeAndSettle, checkSwedishPersNo, authorizeAndSettle.
48
48
  - The other methods should work, but have not been tested.
49
- - It does not handle timeouts as-is.
50
49
 
51
50
  API docs
52
51
  ----
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "debitech_soap"
7
7
  s.version = DebitechSoap::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Joakim Kolsjö", 'Niklas Holmgren', 'Henrik Nyh']
9
+ s.authors = ["Joakim Kolsjö", 'Niklas Holmgren', 'Henrik Nyh', 'Daniel Eriksson']
10
10
  s.email = ["joakim.kolsjo@gmail.com", 'niklas.holmgren@bukowskis.com', 'henrik@barsoom.se']
11
11
  s.homepage = "http://github.com/joakimk/debitech_soap"
12
12
  s.summary = %q{A pure ruby way to make payments with DebiTech}
@@ -67,10 +67,15 @@ module DebitechSoap
67
67
  args.each_with_index { |argument, i|
68
68
  attributes[parameter_order[i].to_sym] = argument
69
69
  }
70
+ end
71
+ begin
72
+ client_result = return_value(@client.send(api_signature(method).first.first, attributes))
73
+ rescue Timeout::Error
74
+ client_result = OpenStruct.new(:resultCode => 403, :resultText => "SOAP Timeout")
75
+ return return_data(client_result)
70
76
  end
71
-
72
- return_data return_value(@client.send(api_signature(method).first.first, attributes))
73
- end # end
77
+ return_data(client_result)
78
+ end
74
79
  end
75
80
  }
76
81
  end
@@ -88,7 +93,6 @@ module DebitechSoap
88
93
  hash[attribute.underscore] = result
89
94
  end
90
95
  }
91
-
92
96
  OpenStruct.new(hash)
93
97
  end
94
98
 
@@ -1,3 +1,3 @@
1
1
  module DebitechSoap
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -177,3 +177,19 @@ describe DebitechSoap::API, "calling a method with hash-style arguments" do
177
177
 
178
178
  end
179
179
 
180
+ describe DebitechSoap::API, "handling exceptions" do
181
+
182
+ before do
183
+ @client = mock(Object)
184
+ SOAP::WSDLDriverFactory.stub!(:new).and_return(mock(Object, :create_rpc_driver => @client))
185
+ end
186
+
187
+ it "should catch Timeout::Error and return 403" do
188
+ api = DebitechSoap::API.new
189
+ @client.stub!("refund").and_raise(Timeout::Error)
190
+ result = api.refund(:verifyID => 1234567, :transID => 23456, :amount => 100, :extra => "extra")
191
+ result.getResultCode.should == 403
192
+ result.getResultText.should == "SOAP Timeout"
193
+ end
194
+
195
+ end
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debitech_soap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Joakim Kolsj\xC3\xB6"
14
14
  - Niklas Holmgren
15
15
  - Henrik Nyh
16
+ - Daniel Eriksson
16
17
  autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []