sisow 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,21 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sisow (1.0.0)
4
+ sisow (1.0.1)
5
+ crack
5
6
  hashie
6
- httparty
7
+ httpi
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
12
+ crack (0.3.1)
11
13
  diff-lcs (1.1.3)
12
14
  fakeweb (1.3.0)
13
15
  hashie (1.2.0)
14
- httparty (0.8.3)
15
- multi_json (~> 1.0)
16
- multi_xml
16
+ httpi (1.1.1)
17
+ rack
17
18
  multi_json (1.3.5)
18
- multi_xml (0.5.1)
19
+ rack (1.4.1)
19
20
  rake (0.9.2.2)
20
21
  rspec (2.10.0)
21
22
  rspec-core (~> 2.10.0)
data/lib/sisow.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'rubygems'
2
- require 'httparty'
2
+ require 'httpi'
3
3
  require 'hashie'
4
4
  require 'cgi'
5
+ require 'crack/xml'
5
6
 
6
7
  require 'sisow/configuration'
7
8
  require 'sisow/error_response'
@@ -2,8 +2,7 @@ module Sisow
2
2
  module Api
3
3
  class Request
4
4
 
5
- include HTTParty
6
- base_uri "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/"
5
+ BASE_URI = "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx"
7
6
 
8
7
  def self.perform
9
8
  new.perform
@@ -14,8 +13,9 @@ module Sisow
14
13
 
15
14
  validate!
16
15
 
17
- response = self.class.get(uri)
18
- response = Hashie::Mash.new(response)
16
+ http_response = HTTPI.get(base_uri + uri)
17
+ parsed_response = Crack::XML.parse(http_response.body)
18
+ response = Hashie::Mash.new(parsed_response)
19
19
 
20
20
  error!(response) if response.errorresponse?
21
21
 
@@ -61,6 +61,10 @@ module Sisow
61
61
  raise Sisow::Exception, error_response.message and return
62
62
  end
63
63
 
64
+ def base_uri
65
+ Sisow.configuration.base_uri || BASE_URI
66
+ end
67
+
64
68
  end
65
69
  end
66
70
  end
@@ -97,6 +97,7 @@ module Sisow
97
97
  Sisow.configuration.merchant_id,
98
98
  Sisow.configuration.merchant_key
99
99
  ].join
100
+
100
101
  calculated_sha1 = Digest::SHA1.hexdigest(string)
101
102
 
102
103
  if calculated_sha1 != response.transactionrequest.signature.sha1
@@ -1,7 +1,7 @@
1
1
  module Sisow
2
2
  class Configuration
3
3
 
4
- attr_accessor :merchant_id, :merchant_key, :test_mode, :debug_mode, :shop_id
4
+ attr_accessor :merchant_id, :merchant_key, :test_mode, :debug_mode, :shop_id, :base_uri
5
5
 
6
6
  def initialize
7
7
  @debug_mode = false
@@ -19,9 +19,10 @@ module Sisow
19
19
  @debug_mode = boolean
20
20
 
21
21
  if boolean == true
22
- Sisow::Api::Request.debug_output $stderr
22
+ HTTPI.log = true
23
+ HTTPI.log_level = :debug
23
24
  else
24
- Sisow::Api::Request.debug_output nil
25
+ HTTPI.log = false
25
26
  end
26
27
  end
27
28
 
data/lib/sisow/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sisow
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/sisow.gemspec CHANGED
@@ -19,12 +19,14 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'httparty'
22
+ s.add_dependency 'httpi'
23
23
  s.add_dependency 'hashie'
24
+ s.add_dependency 'crack'
24
25
 
25
26
  s.add_development_dependency 'rspec'
26
27
  s.add_development_dependency 'vcr'
27
28
  s.add_development_dependency 'fakeweb'
28
29
  s.add_development_dependency 'simplecov'
29
30
  s.add_development_dependency 'simplecov-rcov'
31
+
30
32
  end
@@ -31,5 +31,4 @@ describe Sisow::Configuration do
31
31
  @configuration.merchant_id.should == '123'
32
32
  end
33
33
 
34
-
35
34
  end
@@ -12,7 +12,8 @@ describe Sisow::Api::Request do
12
12
  end
13
13
 
14
14
  it "should point to the base URI of the Sisow API" do
15
- Sisow::Api::Request.base_uri.should == "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx"
15
+ request = Sisow::Api::Request.new
16
+ request.send(:base_uri).should == "http://www.sisow.nl/Sisow/iDeal/RestHandler.ashx"
16
17
  end
17
18
 
18
19
  it "should perform properly" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sisow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: httparty
15
+ name: httpi
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: crack
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rspec
48
64
  requirement: !ruby/object:Gem::Requirement