debitech_soap 0.0.3 → 0.0.4

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.
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - ree
3
+
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.4
2
+
3
+ Ruby 1.9 compability. Support for both the standard library soap implementation and soap4r.
4
+
1
5
  0.0.3
2
6
 
3
7
  Added support for Java style method names.
@@ -1,28 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- debitech_soap (0.0.2)
4
+ debitech_soap (0.0.4)
5
+ mumboe-soap4r (~> 1.5.8.4)
5
6
 
6
7
  GEM
7
8
  remote: http://rubygems.org/
8
9
  specs:
9
- ZenTest (4.4.2)
10
- autotest (4.4.6)
11
- ZenTest (>= 4.4.1)
12
- diff-lcs (1.1.2)
13
- rspec (2.3.0)
14
- rspec-core (~> 2.3.0)
15
- rspec-expectations (~> 2.3.0)
16
- rspec-mocks (~> 2.3.0)
17
- rspec-core (2.3.1)
18
- rspec-expectations (2.3.0)
10
+ diff-lcs (1.1.3)
11
+ guard (0.8.8)
12
+ thor (~> 0.14.6)
13
+ guard-rspec (0.5.0)
14
+ guard (>= 0.8.4)
15
+ httpclient (2.2.2)
16
+ mumboe-soap4r (1.5.8.4)
17
+ httpclient (>= 2.1.1)
18
+ rake (0.9.2)
19
+ rspec (2.7.0)
20
+ rspec-core (~> 2.7.0)
21
+ rspec-expectations (~> 2.7.0)
22
+ rspec-mocks (~> 2.7.0)
23
+ rspec-core (2.7.1)
24
+ rspec-expectations (2.7.0)
19
25
  diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.3.0)
26
+ rspec-mocks (2.7.0)
27
+ thor (0.14.6)
21
28
 
22
29
  PLATFORMS
23
30
  ruby
24
31
 
25
32
  DEPENDENCIES
26
- autotest
27
33
  debitech_soap!
34
+ guard
35
+ guard-rspec
36
+ rake
28
37
  rspec
@@ -0,0 +1,5 @@
1
+ guard 'rspec', :version => 2, :cli => "--color" do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec" }
4
+ end
5
+
@@ -1,11 +1,3 @@
1
- Work in progress!
2
- ----
3
-
4
- This is **work in progress and not usable yet**. [Readme Driven Development](http://tom.preston-werner.com/2010/08/23/readme-driven-development.html)...
5
-
6
- WIP docs below
7
- ----
8
-
9
1
  This is a wrapper of the DebiTech SOAP API. It's intended to be API compatible with the DebiTech Java client but also supports a more developer friendly syntax :).
10
2
 
11
3
  Installing
@@ -49,13 +41,19 @@ Return data
49
41
  - Each attribute has serveral methods, for example "infoCode" can also be "getInfoCode" or "get_info_code".
50
42
  - If the return value is a number it will be converted to an integer.
51
43
 
44
+ Gotchas
45
+ ----
46
+
47
+ - We have only used the following methods in production: askIf3DSEnrolled, authorize3DS, authorize, subscribeAndSettle, checkSwedishPersNo, authorizeAndSettle.
48
+ - The other methods should work, but have not been tested.
49
+ - It does not handle timeouts as-is.
50
+
52
51
  API docs
53
52
  ----
54
53
 
55
54
  Get DIBSServerManual.pdf from the DIBS Manager.
56
55
 
57
- Known issues
56
+ CI
58
57
  ----
59
58
 
60
- - Does not work with Ruby 1.9 (does not have "soap/wsdlDriver"). We have not been able to get "savon" to work.
61
-
59
+ - DebitechSoap is continuously tested for compability with Ruby 1.9.3 (preview 1), Ruby 1.8.7 and JRuby 1.6.2.
@@ -6,14 +6,18 @@ 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']
10
- s.email = ["joakim.kolsjo@gmail.com", 'niklas.holmgren@bukowskis.com']
9
+ s.authors = ["Joakim Kolsjö", 'Niklas Holmgren', 'Henrik Nyh']
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}
13
13
  s.description = %q{An implementation of the DebiTech Java API using pure ruby and the SOAP API.}
14
14
 
15
+ s.add_dependency "mumboe-soap4r", "~> 1.5.8.4"
16
+
17
+ s.add_development_dependency "rake"
15
18
  s.add_development_dependency 'rspec'
16
- s.add_development_dependency 'autotest'
19
+ s.add_development_dependency "guard"
20
+ s.add_development_dependency "guard-rspec"
17
21
 
18
22
  s.files = `git ls-files`.split("\n")
19
23
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,6 +1,5 @@
1
1
  require 'soap/wsdlDriver'
2
2
  require 'ostruct'
3
- require 'rubygems'
4
3
  require 'debitech_soap/string_extensions'
5
4
 
6
5
  module DebitechSoap
@@ -42,12 +41,19 @@ module DebitechSoap
42
41
 
43
42
  def valid_credentials?
44
43
  disable_stderr do
45
- @client.checkSwedishPersNo(@api_credentials.merge({ :persNo => "555555-5555" })).return == "true"
44
+ return_value(@client.checkSwedishPersNo(@api_credentials.merge({ :persNo => "555555-5555" }))) == "true"
46
45
  end
47
46
  end
48
47
 
49
48
  private
50
49
 
50
+ # We use mumboe-soap4r for Ruby 1.9 compatibility, but if you use this library in 1.8 without using that lib
51
+ # (e.g. without bundle exec) then you might get the standard library SOAP lib instead.
52
+ # The standard library SOAP lib uses "return" here, and mumboe-soap4r uses "m_return".
53
+ def return_value(object)
54
+ object.respond_to?(:m_return) ? object.m_return : object.return
55
+ end
56
+
51
57
  def define_java_wrapper_methods!
52
58
  PARAMS.keys.flatten.each { |method|
53
59
  (class << self; self; end).class_eval do # Doc:
@@ -63,7 +69,7 @@ module DebitechSoap
63
69
  }
64
70
  end
65
71
 
66
- return_data @client.send(api_signature(method).first.first, attributes).return
72
+ return_data return_value(@client.send(api_signature(method).first.first, attributes))
67
73
  end # end
68
74
  end
69
75
  }
@@ -1,3 +1,3 @@
1
1
  module DebitechSoap
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -12,6 +12,14 @@ class MockSoapResult
12
12
  end
13
13
  end
14
14
 
15
+ class MockSoapResultRuby19
16
+ class MockReturn < MockSoapResult::MockReturn; end
17
+
18
+ def m_return
19
+ @return ||= MockReturn.new
20
+ end
21
+ end
22
+
15
23
  describe DebitechSoap::API, "valid_credentials?" do
16
24
 
17
25
  before do
@@ -34,6 +42,12 @@ describe DebitechSoap::API, "valid_credentials?" do
34
42
  api.valid_credentials?.should == false
35
43
  end
36
44
 
45
+ it "should work with Ruby 1.9 SOAP API" do
46
+ @client.stub!(:checkSwedishPersNo).and_return(mock(Object, :m_return => "true"))
47
+ api = DebitechSoap::API.new
48
+ api.valid_credentials?.should == true
49
+ end
50
+
37
51
  end
38
52
 
39
53
  describe DebitechSoap::API, "calling a method with java-style arguments" do
@@ -118,6 +132,15 @@ describe DebitechSoap::API, "calling a method with java-style arguments" do
118
132
  result.resultCode.should == 0
119
133
  end
120
134
 
135
+ it "should work with Ruby 1.9 SOAP API" do
136
+ api = DebitechSoap::API.new
137
+ mock_soap_result = MockSoapResultRuby19.new
138
+ mock_soap_result.m_return.stub!(:resultCode).and_return("0")
139
+ @client.stub!("refund").and_return(mock_soap_result)
140
+ result = api.refund(1234567, 23456, 100, "extra")
141
+ result.resultCode.should == 0
142
+ end
143
+
121
144
  end
122
145
 
123
146
  describe DebitechSoap::API, "calling a method with hash-style arguments" do
@@ -143,5 +166,14 @@ describe DebitechSoap::API, "calling a method with hash-style arguments" do
143
166
  api.refund(:verifyID => 1234567, :transID => 23456, :amount => 100, :extra => "extra").getResultText.should == "success"
144
167
  end
145
168
 
169
+ it "should work with Ruby 1.9 SOAP API" do
170
+ api = DebitechSoap::API.new
171
+ mock_soap_result = MockSoapResultRuby19.new
172
+ mock_soap_result.m_return.stub!(:resultText).and_return("success")
173
+ @client.stub!("refund").and_return(mock_soap_result)
174
+ result = api.refund(:verifyID => 1234567, :transID => 23456, :amount => 100, :extra => "extra")
175
+ result.getResultText.should == "success"
176
+ end
177
+
146
178
  end
147
179
 
metadata CHANGED
@@ -1,28 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debitech_soap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Joakim Kolsj\xC3\xB6"
14
14
  - Niklas Holmgren
15
+ - Henrik Nyh
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-01-27 00:00:00 +01:00
20
+ date: 2011-10-24 00:00:00 +02:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
- name: rspec
24
+ name: mumboe-soap4r
24
25
  prerelease: false
25
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ hash: 95
32
+ segments:
33
+ - 1
34
+ - 5
35
+ - 8
36
+ - 4
37
+ version: 1.5.8.4
38
+ type: :runtime
39
+ version_requirements: *id001
40
+ - !ruby/object:Gem::Dependency
41
+ name: rake
42
+ prerelease: false
43
+ requirement: &id002 !ruby/object:Gem::Requirement
26
44
  none: false
27
45
  requirements:
28
46
  - - ">="
@@ -32,11 +50,11 @@ dependencies:
32
50
  - 0
33
51
  version: "0"
34
52
  type: :development
35
- version_requirements: *id001
53
+ version_requirements: *id002
36
54
  - !ruby/object:Gem::Dependency
37
- name: autotest
55
+ name: rspec
38
56
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
57
+ requirement: &id003 !ruby/object:Gem::Requirement
40
58
  none: false
41
59
  requirements:
42
60
  - - ">="
@@ -46,11 +64,40 @@ dependencies:
46
64
  - 0
47
65
  version: "0"
48
66
  type: :development
49
- version_requirements: *id002
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: guard
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: guard-rspec
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ type: :development
95
+ version_requirements: *id005
50
96
  description: An implementation of the DebiTech Java API using pure ruby and the SOAP API.
51
97
  email:
52
98
  - joakim.kolsjo@gmail.com
53
99
  - niklas.holmgren@bukowskis.com
100
+ - henrik@barsoom.se
54
101
  executables: []
55
102
 
56
103
  extensions: []
@@ -60,13 +107,14 @@ extra_rdoc_files: []
60
107
  files:
61
108
  - .gitignore
62
109
  - .rvmrc
110
+ - .travis.yml
63
111
  - CHANGELOG
64
112
  - Gemfile
65
113
  - Gemfile.lock
114
+ - Guardfile
66
115
  - LICENCE
67
116
  - README.markdown
68
117
  - Rakefile
69
- - autotest/discover.rb
70
118
  - debitech_soap.gemspec
71
119
  - lib/debitech_soap.rb
72
120
  - lib/debitech_soap/string_extensions.rb
@@ -102,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
150
  requirements: []
103
151
 
104
152
  rubyforge_project:
105
- rubygems_version: 1.4.1
153
+ rubygems_version: 1.5.3
106
154
  signing_key:
107
155
  specification_version: 3
108
156
  summary: A pure ruby way to make payments with DebiTech
@@ -1 +0,0 @@
1
- Autotest.add_discovery { "rspec2" }