twocheckout 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/twocheckout/api.rb +13 -13
- data/lib/twocheckout/twocheckout_error.rb +0 -9
- data/lib/twocheckout/version.rb +1 -1
- data/test/twocheckout_test.rb +1 -1
- data/twocheckout.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16ad57a7fd3ce73cbaabd0986752cdb9c3b2d09c
|
4
|
+
data.tar.gz: e06eee45323d2f72e20cf0a6766c44359b174db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6347defc9ccd992b6223fc28d08b21827986db1b9de5562630d54ecc83efa0a938363716163331bbbbe67eaab62c29a6976a8fed71f223a3972c8d1a84fe6ca5
|
7
|
+
data.tar.gz: 4ae23fcb28ff68f633bc0e37b6af9df9ac6ade4a9686e328c0be0a96ed0b499b0566f47e8dc71b42e9979b5828c787a32810a33dd8e5d6bfc7a90cc0e9a34c20
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ Or import into your Gemfile.
|
|
15
15
|
gem "twocheckout"
|
16
16
|
```
|
17
17
|
|
18
|
-
Full documentation for each binding is provided in the **[2Checkout Documentation](https://
|
18
|
+
Full documentation for each binding is provided in the **[2Checkout Documentation](https://www.2checkout.com/documentation/libraries/ruby)**.
|
19
19
|
|
20
20
|
|
21
21
|
Example Purchase API Usage
|
@@ -284,4 +284,4 @@ end
|
|
284
284
|
"Lineitem is not scheduled to recur."
|
285
285
|
```
|
286
286
|
|
287
|
-
Full documentation for each binding is provided in the **[2Checkout Documentation](https://
|
287
|
+
Full documentation for each binding is provided in the **[2Checkout Documentation](https://www.2checkout.com/documentation/libraries/ruby)**.
|
data/lib/twocheckout/api.rb
CHANGED
@@ -8,11 +8,11 @@ module Twocheckout
|
|
8
8
|
API_VERSION = '1'
|
9
9
|
|
10
10
|
def self.credentials=(opts)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
@username = opts[:username]
|
12
|
+
@password = opts[:password]
|
13
|
+
@private_key = opts[:private_key]
|
14
|
+
@seller_id = opts[:seller_id]
|
15
|
+
@sandbox = opts[:sandbox]
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.request(http_method, api_call, params = nil)
|
@@ -23,9 +23,9 @@ module Twocheckout
|
|
23
23
|
rescue => e
|
24
24
|
error_hash = JSON.parse(e.response)
|
25
25
|
if error_hash['exception']
|
26
|
-
raise TwocheckoutError.new(error_hash['exception']['errorMsg'])
|
26
|
+
raise TwocheckoutError.new(error_hash['exception']['errorMsg'])
|
27
27
|
else
|
28
|
-
raise TwocheckoutError.new(error_hash['errors'][0]['message'])
|
28
|
+
raise TwocheckoutError.new(error_hash['errors'][0]['message'])
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -33,11 +33,11 @@ module Twocheckout
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def self.set_opts(http_method, api_call, params = null)
|
36
|
-
url =
|
36
|
+
url = @sandbox ? SANDBOX_BASE : PROD_BASE
|
37
37
|
if api_call == 'authService'
|
38
|
-
url += '/checkout/api/' + API_VERSION + '/' +
|
39
|
-
params['sellerId'] =
|
40
|
-
params['privateKey'] =
|
38
|
+
url += '/checkout/api/' + API_VERSION + '/' + @seller_id + '/rs/' + api_call
|
39
|
+
params['sellerId'] = @seller_id
|
40
|
+
params['privateKey'] = @private_key
|
41
41
|
opts = {
|
42
42
|
:method => http_method,
|
43
43
|
:url => url,
|
@@ -63,8 +63,8 @@ module Twocheckout
|
|
63
63
|
:content_type => :json,
|
64
64
|
:user_agent => "2Checkout/Ruby/," + Twocheckout::VERSION
|
65
65
|
},
|
66
|
-
:user =>
|
67
|
-
:password =>
|
66
|
+
:user => @username,
|
67
|
+
:password => @password,
|
68
68
|
:payload => params,
|
69
69
|
}
|
70
70
|
end
|
data/lib/twocheckout/version.rb
CHANGED
data/test/twocheckout_test.rb
CHANGED
@@ -294,7 +294,7 @@ describe Twocheckout::Checkout do
|
|
294
294
|
begin
|
295
295
|
result = Twocheckout::Checkout.authorize(params)
|
296
296
|
assert_equal("APPROVED", result['responseCode'])
|
297
|
-
rescue
|
297
|
+
rescue Twocheckout::TwocheckoutError => e
|
298
298
|
assert_equal("Unauthorized", e.message)
|
299
299
|
end
|
300
300
|
end
|
data/twocheckout.gemspec
CHANGED
@@ -4,7 +4,7 @@ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.name = 'twocheckout'
|
7
|
-
s.version = '0.3.
|
7
|
+
s.version = '0.3.1'
|
8
8
|
s.summary = '2Checkout Ruby Library'
|
9
9
|
s.description = '0.3.0'
|
10
10
|
s.summary = '2Checkout Ruby Library'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twocheckout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Christenson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|