fingertips-adyen 0.3.8.20100930 → 0.3.8.20100930.2

Sign up to get free protection for your applications and to get access to all the features.
data/adyen.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = 'adyen'
3
- s.version = "0.3.8"
4
- s.date = "2010-09-23"
2
+ s.name = 'fingertips-adyen'
3
+ s.version = "0.3.8.20100929"
4
+ s.date = "2010-09-29"
5
5
 
6
6
  s.summary = "Integrate Adyen payment services in your Ruby on Rails application."
7
7
  s.description = <<-EOS
@@ -13,23 +13,22 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.authors = ['Willem van Bergen', 'Michel Barbosa', 'Stefan Borsje', 'Eloy Duran']
15
15
  s.email = ['willem@vanbergen.org', 'cicaboo@gmail.com', 'mail@sborsje.nl', 'eloy.de.enige@gmail.com']
16
- s.homepage = 'http://github.com/wvanbergen/adyen/wiki'
16
+ s.homepage = 'http://wiki.github.com/wvanbergen/adyen'
17
17
 
18
18
  s.add_development_dependency('rake')
19
19
  s.add_development_dependency('rspec', '>= 1.1.4')
20
+ s.add_development_dependency('git', '>= 1.1.0')
21
+ s.add_development_dependency('gemcutter')
20
22
 
21
23
  # Drop or make runtime dependency.
22
24
  s.add_development_dependency('activerecord')
23
- s.add_development_dependency('handsoap')
24
25
  s.add_development_dependency('nokogiri')
25
26
 
26
- s.requirements << 'Handsoap is required for accessing the SOAP services. See http://github.com/troelskn/handsoap.'
27
27
  s.requirements << 'ActiveRecord is required for storing the notifications in your database.'
28
28
 
29
29
  s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
30
30
  s.extra_rdoc_files = ['README.rdoc']
31
31
 
32
- s.files = %w(spec/spec_helper.rb spec/adyen_spec.rb lib/adyen/form.rb .gitignore spec/notification_spec.rb lib/adyen/soap.rb LICENSE spec/soap_spec.rb init.rb adyen.gemspec Rakefile spec/form_spec.rb README.rdoc lib/adyen/notification.rb lib/adyen/formatter.rb tasks/github-gem.rake lib/adyen/encoding.rb TODO lib/adyen/matchers.rb lib/adyen.rb)
33
- s.test_files = %w(spec/adyen_spec.rb spec/notification_spec.rb spec/soap_spec.rb spec/form_spec.rb)
32
+ s.files = %w(spec/spec_helper.rb spec/adyen_spec.rb lib/adyen/form.rb .gitignore spec/notification_spec.rb lib/adyen/api.rb LICENSE spec/api_spec.rb init.rb adyen.gemspec Rakefile spec/form_spec.rb README.rdoc lib/adyen/notification.rb lib/adyen/formatter.rb tasks/github-gem.rake lib/adyen/encoding.rb TODO lib/adyen/matchers.rb lib/adyen.rb)
33
+ s.test_files = %w(spec/adyen_spec.rb spec/notification_spec.rb spec/api_spec.rb spec/form_spec.rb)
34
34
  end
35
-
data/lib/adyen/api.rb CHANGED
@@ -44,6 +44,16 @@ module Adyen
44
44
  #
45
45
 
46
46
  class SimpleSOAPClient
47
+ class ClientError < StandardError
48
+ def initialize(response, action, endpoint)
49
+ @response, @action, @endpoint = response, action, endpoint
50
+ end
51
+
52
+ def message
53
+ "[#{@response.code} #{@response.message}] A client error occurred while calling SOAP action `#{@action}' on endpoint `#{@endpoint}'."
54
+ end
55
+ end
56
+
47
57
  # from http://curl.haxx.se/ca/cacert.pem
48
58
  CACERT = File.expand_path('../../../support/cacert.pem', __FILE__)
49
59
 
@@ -78,7 +88,9 @@ module Adyen
78
88
  request.verify_mode = OpenSSL::SSL::VERIFY_PEER
79
89
 
80
90
  request.start do |http|
81
- response_class.new(http.request(post))
91
+ http_response = http.request(post)
92
+ raise ClientError.new(http_response, action, endpoint) if http_response.is_a?(Net::HTTPClientError)
93
+ response_class.new(http_response)
82
94
  end
83
95
  end
84
96
  end
data/lib/adyen.rb CHANGED
@@ -13,7 +13,7 @@ module Adyen
13
13
  # Version constant for the Adyen plugin.
14
14
  # DO NOT CHANGE THIS VALUE BY HAND. It will be updated automatically by
15
15
  # the gem:release rake task.
16
- VERSION = "0.3.8.20100930"
16
+ VERSION = "0.3.8.20100930.2"
17
17
 
18
18
  # Loads configuration settings from a Hash.
19
19
  #
data/spec/api_spec.rb CHANGED
@@ -267,6 +267,18 @@ describe Adyen::API do
267
267
  @response.should be_instance_of(Adyen::API::Response)
268
268
  @response.xml_querier.to_s.should == AUTHORISE_RESPONSE
269
269
  end
270
+
271
+ it "raises when the HTTP response is a subclass of Net::HTTPClientError" do
272
+ Net::HTTP.stubbed_response = Net::HTTPBadRequest.new('1.1', '401', 'Bad request')
273
+ exception = nil
274
+ begin
275
+ @client.call_webservice_action('Action', '<bananas>Yes, please</bananas>', Adyen::API::Response)
276
+ rescue Adyen::API::SimpleSOAPClient::ClientError => e
277
+ exception = e
278
+ end
279
+ msg = "[401 Bad request] A client error occurred while calling SOAP action `Action' on endpoint `https://test.example.com/soap/Action'."
280
+ exception.message.should == msg
281
+ end
270
282
  end
271
283
  end
272
284
 
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingertips-adyen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 40201971
4
+ hash: 80403907
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 8
10
10
  - 20100930
11
- version: 0.3.8.20100930
11
+ - 2
12
+ version: 0.3.8.20100930.2
12
13
  platform: ruby
13
14
  authors:
14
15
  - Willem van Bergen