pin_payment 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pin_payment/charge.rb +10 -0
- data/lib/pin_payment/error.rb +1 -1
- data/lib/pin_payment/version.rb +1 -1
- data/test/test_helper.rb +5 -0
- data/test/test_pin_charge.rb +7 -0
- 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: 93c994264a5a964b1edaca7bc46ece35138ac7c4
|
4
|
+
data.tar.gz: 537bac59e0f8e9ca495444af48ad49c11b2e9125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ded7ba081a51539cfa65adf6a0d1baec4d658bf84d5d3752502b2dee8ec7534b038617337fb16c974a424c3a52aada8cf02b9b217d012280da7a8a5cacf70935
|
7
|
+
data.tar.gz: 37592f8453b6fba91e8afac78b0a4bf754d7b742592486bf2d93585aa3b1c05b3fc1b1af55c3315ff5772d7b2b45b19c542b091e98610b6cce19eaed4998e545
|
data/Gemfile.lock
CHANGED
data/lib/pin_payment/charge.rb
CHANGED
@@ -21,6 +21,16 @@ module PinPayment
|
|
21
21
|
new(response.delete('token'), response)
|
22
22
|
end
|
23
23
|
|
24
|
+
# Fetches a charge using the Pin API.
|
25
|
+
#
|
26
|
+
# @param [String] token the charge token
|
27
|
+
# @return [PinPayment::Charge]
|
28
|
+
def self.find token
|
29
|
+
response = get(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/charges/#{token}" })
|
30
|
+
new(response.delete('token'), response)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
24
34
|
# Fetches all of your charges using the pin API.
|
25
35
|
#
|
26
36
|
# @return [Array<PinPayment::Charge>]
|
data/lib/pin_payment/error.rb
CHANGED
data/lib/pin_payment/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -50,3 +50,8 @@ def created_customer
|
|
50
50
|
FakeWeb.register_uri(:post, 'https://test-api.pin.net.au/1/customers', body: fixtures['responses']['customer']['created'])
|
51
51
|
customer = PinPayment::Customer.create('foo@example.com', card_hash)
|
52
52
|
end
|
53
|
+
|
54
|
+
def created_charge
|
55
|
+
FakeWeb.register_uri(:post, "https://test-api.pin.net.au/1/charges", body: fixtures['responses']['charge']['success'])
|
56
|
+
charge = PinPayment::Charge.create(charge_hash)
|
57
|
+
end
|
data/test/test_pin_charge.rb
CHANGED
@@ -27,6 +27,13 @@ class TestPinCharge < MiniTest::Unit::TestCase
|
|
27
27
|
assert charge.card.token.length > 0
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_find_charge
|
31
|
+
charge = created_charge
|
32
|
+
FakeWeb.register_uri(:get, "https://test-api.pin.net.au/1/charges/#{charge.token}", body: fixtures['responses']['charge']['success'])
|
33
|
+
charge = PinPayment::Charge.find(charge.token)
|
34
|
+
assert_kind_of PinPayment::Charge, charge
|
35
|
+
end
|
36
|
+
|
30
37
|
def test_fetch_all_charges
|
31
38
|
FakeWeb.register_uri(:get, 'https://test-api.pin.net.au/1/charges', body: fixtures['responses']['charge']['all'])
|
32
39
|
charges = PinPayment::Charge.all
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pin_payment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danial Pearce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakeweb
|