payjp 0.0.13 → 0.0.14

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
  SHA256:
3
- metadata.gz: d0270ff64998ad57112bcf113594f8db36b931f1d1dd468dbd3bae4e1c16eb70
4
- data.tar.gz: c0e32cbbb9b0ee609c4ff0e30f2621367d61a74276f819a2abfdf754bf4e62a8
3
+ metadata.gz: 32fcd8c9e2569e568458d8eac4dc882d1900e75577f8ff686801085b7d202385
4
+ data.tar.gz: a4dd505473e1bf7fbd0fcd56c1620f00d5f4a39781f1c1ffdabc623f55d16464
5
5
  SHA512:
6
- metadata.gz: c45bd79ebfc04ac60497e4c7b844f060eb5acf6148fde65d27dd97d64dd81bd6712b4be4d98f9f1e072ca313d1afbcc1491a69d367b3b393571a811226c568c5
7
- data.tar.gz: 9aaf07bc44d9002f5957bf73df57c5778700d7b0932968cafb22bba89e189e55ab0d83c5e5c3e4fab4891eef2b668098c851c034fa9f171c82bcf10c7f11530f
6
+ metadata.gz: 686404e37c62aafe0ce82a76264db1003651b3f43cc027cdae712911db20aaa3f0876ed7de74737d827e37fd97123406837dcaa4b6478c257f17ec7d411a1c0e
7
+ data.tar.gz: 257f55f34bd2aa2347c14cbf0dadaa49229a36c21a6d130751f24984d175a01f4d31e1ef5418cff772c883c8bcfc0c47c584995ed03bcde7a7a8e0107d2a340f
@@ -0,0 +1,5 @@
1
+ module Payjp
2
+ class Balance < APIResource
3
+ include Payjp::APIOperations::List
4
+ end
5
+ end
data/lib/payjp/term.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Payjp
2
+ class Term < APIResource
3
+ include Payjp::APIOperations::List
4
+ end
5
+ end
data/lib/payjp/util.rb CHANGED
@@ -22,6 +22,7 @@ module Payjp
22
22
 
23
23
  # business objects
24
24
  'account' => Account,
25
+ 'balance' => Balance,
25
26
  'card' => Card,
26
27
  'charge' => Charge,
27
28
  'customer' => Customer,
@@ -30,6 +31,7 @@ module Payjp
30
31
  'plan' => Plan,
31
32
  'statement' => Statement,
32
33
  'subscription' => Subscription,
34
+ 'term' => Term,
33
35
  'token' => Token,
34
36
  'transfer' => Transfer
35
37
  }
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
data/lib/payjp.rb CHANGED
@@ -36,6 +36,8 @@ require 'payjp/card'
36
36
  require 'payjp/statement'
37
37
  require 'payjp/subscription'
38
38
  require 'payjp/tenant'
39
+ require 'payjp/term'
40
+ require 'payjp/balance'
39
41
 
40
42
  # Errors
41
43
  require 'payjp/errors/payjp_error'
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class BalanceTest < Test::Unit::TestCase
5
+ should "balances should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_balance_array))
7
+ c = Payjp::Balance.all.data
8
+ assert c.is_a? Array
9
+ assert c[0].is_a? Payjp::Balance
10
+ end
11
+
12
+ should "retrieve should retrieve balance" do
13
+ @mock.expects(:get).once.returns(test_response(test_balance))
14
+ balance = Payjp::Balance.retrieve('ba_test_balance')
15
+ assert_equal 'ba_test_balance', balance.id
16
+ end
17
+
18
+ should "balances should not be deletable" do
19
+ assert_raises NoMethodError do
20
+ @mock.expects(:get).once.returns(test_response(test_balance))
21
+ balance = Payjp::Balance.retrieve('ba_test_balance')
22
+ balance.delete
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class TermTest < Test::Unit::TestCase
5
+ should "terms should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_term_array))
7
+ c = Payjp::Term.all.data
8
+ assert c.is_a? Array
9
+ assert c[0].is_a? Payjp::Term
10
+ end
11
+
12
+ should "retrieve should retrieve term" do
13
+ @mock.expects(:get).once.returns(test_response(test_term))
14
+ term = Payjp::Term.retrieve('tm_test_term')
15
+ assert_equal 'tm_test_term', term.id
16
+ end
17
+
18
+ should "terms should not be deletable" do
19
+ assert_raises NoMethodError do
20
+ @mock.expects(:get).once.returns(test_response(test_term))
21
+ term = Payjp::Term.retrieve('tm_test_term')
22
+ term.delete
23
+ end
24
+ end
25
+ end
26
+ end
data/test/test_data.rb CHANGED
@@ -359,7 +359,9 @@ module Payjp
359
359
  }
360
360
  ],
361
361
  :object => "statement",
362
- :title => nil
362
+ :title => nil,
363
+ :tenant_id => nil,
364
+ :updated => 1695892351
363
365
  }.merge(params)
364
366
  end
365
367
 
@@ -371,5 +373,57 @@ module Payjp
371
373
  :url => '/v1/statements'
372
374
  }
373
375
  end
376
+
377
+ def test_term_array
378
+ {
379
+ :count => 3,
380
+ :data => [test_term, test_term, test_term],
381
+ :object => 'list',
382
+ :url => '/v1/terms'
383
+ }
384
+ end
385
+
386
+ def test_term(params = {})
387
+ {
388
+ :id => "tm_test_term",
389
+ :livemode => false,
390
+ :object => "term",
391
+ :charge_count => 158,
392
+ :refund_count => 25,
393
+ :dispute_count => 2,
394
+ :end_at => 1439650800,
395
+ :start_at => 1438354800
396
+ }.merge(params)
397
+ end
398
+
399
+ def test_balance_array
400
+ {
401
+ :count => 3,
402
+ :data => [test_balance, test_balance, test_balance],
403
+ :object => 'list',
404
+ :url => '/v1/terms'
405
+ }
406
+ end
407
+
408
+ def test_balance(params = {})
409
+ {
410
+ :created => 1438354800,
411
+ :id => 'ba_test_balance',
412
+ :livemode => false,
413
+ :net => 1000,
414
+ :object => 'balance',
415
+ :state => 'collecting',
416
+ :tenant_id => nil,
417
+ :statements => {
418
+ :count => 2,
419
+ :data => [test_statement,test_statement],
420
+ :object => 'list',
421
+ :url => '/v1/statements'
422
+ },
423
+ :closed => false,
424
+ :due_date => nil,
425
+ :bank_info => nil
426
+ }.merge(params)
427
+ end
374
428
  end
375
429
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -126,6 +126,7 @@ files:
126
126
  - lib/payjp/api_operations/request.rb
127
127
  - lib/payjp/api_operations/update.rb
128
128
  - lib/payjp/api_resource.rb
129
+ - lib/payjp/balance.rb
129
130
  - lib/payjp/card.rb
130
131
  - lib/payjp/charge.rb
131
132
  - lib/payjp/customer.rb
@@ -142,6 +143,7 @@ files:
142
143
  - lib/payjp/statement.rb
143
144
  - lib/payjp/subscription.rb
144
145
  - lib/payjp/tenant.rb
146
+ - lib/payjp/term.rb
145
147
  - lib/payjp/token.rb
146
148
  - lib/payjp/transfer.rb
147
149
  - lib/payjp/util.rb
@@ -149,6 +151,7 @@ files:
149
151
  - payjp.gemspec
150
152
  - test/payjp/account_test.rb
151
153
  - test/payjp/api_resource_test.rb
154
+ - test/payjp/balance_test.rb
152
155
  - test/payjp/charge_test.rb
153
156
  - test/payjp/customer_card_test.rb
154
157
  - test/payjp/customer_test.rb
@@ -160,6 +163,7 @@ files:
160
163
  - test/payjp/statement_test.rb
161
164
  - test/payjp/subscription_test.rb
162
165
  - test/payjp/tenant_test.rb
166
+ - test/payjp/term_test.rb
163
167
  - test/payjp/token_test.rb
164
168
  - test/payjp/transfer_test.rb
165
169
  - test/payjp/util_test.rb
@@ -192,6 +196,7 @@ summary: Ruby bindings for the Payjp API
192
196
  test_files:
193
197
  - test/payjp/account_test.rb
194
198
  - test/payjp/api_resource_test.rb
199
+ - test/payjp/balance_test.rb
195
200
  - test/payjp/charge_test.rb
196
201
  - test/payjp/customer_card_test.rb
197
202
  - test/payjp/customer_test.rb
@@ -203,6 +208,7 @@ test_files:
203
208
  - test/payjp/statement_test.rb
204
209
  - test/payjp/subscription_test.rb
205
210
  - test/payjp/tenant_test.rb
211
+ - test/payjp/term_test.rb
206
212
  - test/payjp/token_test.rb
207
213
  - test/payjp/transfer_test.rb
208
214
  - test/payjp/util_test.rb