payout 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85330fbe4dd8d6e1a4dd4fe9a3ebea9b548387d6
4
- data.tar.gz: 5423abe20ab180b944ac6e1d8dbc896b5b1d2e7e
3
+ metadata.gz: 39aaf0d234aa42aeba2191be3e9d49ed17ff868d
4
+ data.tar.gz: 1e3aad3ed0428782ea8f3962a0b60edd9b3a3d44
5
5
  SHA512:
6
- metadata.gz: 9c47bac307a46dacb00bb20e1fc892f7b6649a7894c8c6913c264654933d639fed7216658c5ec7e4423a964cce6e8630f53a03a0453acd187983ccc3342ce17f
7
- data.tar.gz: bb4d6d13e77944bbcf7a3eb1c6749a0d61e77c06bc4753b037779018879f118d9700b5781ad6ce67715fc30c052d076e1effb167c27c242d977069f3d9413f9a
6
+ metadata.gz: cf51ae913ee62265cbb5d8eca681e45c5765049bb396cb2f85b5173d9e24f23717a71d8c7f2ae3f366460e6a3d6dd96d21e6404a336dae30e403ca9e02f31001
7
+ data.tar.gz: 8d3c1a71230e2386d6ed04463d1dd794f9be6158516b4be2c3b28f0467b693597376dece31f3cc15da52553a6fcae7227000fc1c9537eaa8f44831acb318d349
data/lib/payout/v1.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Payout::V1
2
- autoload(:Balance, 'payout/v1/balance')
3
- autoload(:Card, 'payout/v1/card')
4
- autoload(:Payment, 'payout/v1/payment')
2
+ autoload(:Balance, 'payout/v1/balance')
3
+ autoload(:Card, 'payout/v1/card')
4
+ autoload(:BankAccount, 'payout/v1/bank_account')
5
+ autoload(:Payment, 'payout/v1/payment')
5
6
  end
@@ -0,0 +1,32 @@
1
+ module Payout
2
+ module V1::BankAccount
3
+ class << self
4
+ def retrieve(token)
5
+ Payout.request(:get, "/v1/bank_accounts/#{token}")
6
+ end
7
+
8
+ def tokenize(params)
9
+ Payout.request(:post, '/v1/bank_accounts', params)
10
+ end
11
+
12
+ def update_customer(params)
13
+ token, params = _extract_token(params.dup)
14
+ Payout.request(:put, "/v1/bank_accounts/#{token}/customer", params)
15
+ end
16
+
17
+ def credit(params)
18
+ token, params = _extract_token(params.dup)
19
+ Payout.request(:post, "/v1/bank_accounts/#{token}/credits", params)
20
+ end
21
+
22
+ private
23
+
24
+ def _extract_token(params)
25
+ token = params.delete(:bank_account_token) or
26
+ fail ArgumentError, 'missing bank_account_token'
27
+
28
+ [token, params]
29
+ end
30
+ end
31
+ end # V1::BankAccount
32
+ end # Payout
@@ -10,19 +10,22 @@ module Payout
10
10
  end
11
11
 
12
12
  def update_customer(params)
13
- params = params.dup
14
- token = params.delete(:card_token) or
15
- fail ArgumentError, 'missing card_token'
16
-
13
+ token, params = _extract_token(params.dup)
17
14
  Payout.request(:put, "/v1/cards/#{token}/customer", params)
18
15
  end
19
16
 
20
17
  def credit(params)
21
- params = params.dup
18
+ token, params = _extract_token(params.dup)
19
+ Payout.request(:post, "/v1/cards/#{token}/credits", params)
20
+ end
21
+
22
+ private
23
+
24
+ def _extract_token(params)
22
25
  token = params.delete(:card_token) or
23
26
  fail ArgumentError, 'missing card_token'
24
27
 
25
- Payout.request(:post, "/v1/cards/#{token}/credits", params)
28
+ [token, params]
26
29
  end
27
30
  end
28
31
  end # V1::Card
@@ -1,3 +1,3 @@
1
1
  module Payout
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payout
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
  - Robert Honer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-24 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -49,6 +49,7 @@ files:
49
49
  - lib/payout/response.rb
50
50
  - lib/payout/v1.rb
51
51
  - lib/payout/v1/balance.rb
52
+ - lib/payout/v1/bank_account.rb
52
53
  - lib/payout/v1/card.rb
53
54
  - lib/payout/v1/payment.rb
54
55
  - lib/payout/version.rb