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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b482e0e3054497d152ef8302a1fa9af339834cf
4
- data.tar.gz: 7394ef6e8624ac96d1db2b1e726141c0a918e4df
3
+ metadata.gz: 93c994264a5a964b1edaca7bc46ece35138ac7c4
4
+ data.tar.gz: 537bac59e0f8e9ca495444af48ad49c11b2e9125
5
5
  SHA512:
6
- metadata.gz: 719872f68f5a3bdcec2f6be1368bb3a11f71281508b8b05f9a1fcc527b6c520f0a9d434e04a5b3f2bf0110dd43f5735e792c13760e67bb078a4dab931a3a774d
7
- data.tar.gz: 66826324dcb94dc9bca096c36037c23d452a64068f6545dc414edbed98d98aa053e25103185fdba09db8187e781c7f449facc90111b65fbded2111fda85d00f1
6
+ metadata.gz: ded7ba081a51539cfa65adf6a0d1baec4d658bf84d5d3752502b2dee8ec7534b038617337fb16c974a424c3a52aada8cf02b9b217d012280da7a8a5cacf70935
7
+ data.tar.gz: 37592f8453b6fba91e8afac78b0a4bf754d7b742592486bf2d93585aa3b1c05b3fc1b1af55c3315ff5772d7b2b45b19c542b091e98610b6cce19eaed4998e545
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pin_payment (0.1.0)
4
+ pin_payment (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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>]
@@ -1,5 +1,5 @@
1
1
  module PinPayment
2
- class Error < Exception
2
+ class Error < StandardError
3
3
 
4
4
  def self.create type, description, messages = nil
5
5
  klass = case type
@@ -1,7 +1,7 @@
1
1
  module PinPayment
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
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
@@ -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.1.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-06-27 00:00:00.000000000 Z
11
+ date: 2013-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakeweb