stripe 1.8.5 → 1.8.6
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.
- data/History.txt +4 -0
 - data/VERSION +1 -1
 - data/lib/stripe.rb +2 -0
 - data/lib/stripe/balance.rb +4 -0
 - data/lib/stripe/balance_transaction.rb +9 -0
 - data/lib/stripe/util.rb +2 -0
 - data/lib/stripe/version.rb +1 -1
 - data/test/test_helper.rb +36 -0
 - data/test/test_stripe.rb +20 -0
 - metadata +4 -2
 
    
        data/History.txt
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            1.8. 
     | 
| 
      
 1 
     | 
    
         
            +
            1.8.6
         
     | 
    
        data/lib/stripe.rb
    CHANGED
    
    | 
         @@ -23,6 +23,8 @@ require 'stripe/api_resource' 
     | 
|
| 
       23 
23 
     | 
    
         
             
            require 'stripe/singleton_api_resource'
         
     | 
| 
       24 
24 
     | 
    
         
             
            require 'stripe/list_object'
         
     | 
| 
       25 
25 
     | 
    
         
             
            require 'stripe/account'
         
     | 
| 
      
 26 
     | 
    
         
            +
            require 'stripe/balance'
         
     | 
| 
      
 27 
     | 
    
         
            +
            require 'stripe/balance_transaction'
         
     | 
| 
       26 
28 
     | 
    
         
             
            require 'stripe/customer'
         
     | 
| 
       27 
29 
     | 
    
         
             
            require 'stripe/invoice'
         
     | 
| 
       28 
30 
     | 
    
         
             
            require 'stripe/invoice_item'
         
     | 
    
        data/lib/stripe/util.rb
    CHANGED
    
    
    
        data/lib/stripe/version.rb
    CHANGED
    
    
    
        data/test/test_helper.rb
    CHANGED
    
    | 
         @@ -34,6 +34,42 @@ def test_response(body, code=200) 
     | 
|
| 
       34 
34 
     | 
    
         
             
              m
         
     | 
| 
       35 
35 
     | 
    
         
             
            end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
            def test_balance(params={})
         
     | 
| 
      
 38 
     | 
    
         
            +
              {
         
     | 
| 
      
 39 
     | 
    
         
            +
                :pending => [
         
     | 
| 
      
 40 
     | 
    
         
            +
                  {:amount => 12345, :currency => "usd"}
         
     | 
| 
      
 41 
     | 
    
         
            +
                ],
         
     | 
| 
      
 42 
     | 
    
         
            +
                :available => [
         
     | 
| 
      
 43 
     | 
    
         
            +
                  {:amount => 6789, :currency => "usd"}
         
     | 
| 
      
 44 
     | 
    
         
            +
                ],
         
     | 
| 
      
 45 
     | 
    
         
            +
                :livemode => false,
         
     | 
| 
      
 46 
     | 
    
         
            +
                :object => "balance"
         
     | 
| 
      
 47 
     | 
    
         
            +
              }.merge(params)
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            def test_balance_transaction(params={})
         
     | 
| 
      
 51 
     | 
    
         
            +
              {
         
     | 
| 
      
 52 
     | 
    
         
            +
                :amount => 100,
         
     | 
| 
      
 53 
     | 
    
         
            +
                :net => 41,
         
     | 
| 
      
 54 
     | 
    
         
            +
                :currency => "usd",
         
     | 
| 
      
 55 
     | 
    
         
            +
                :type => "charge",
         
     | 
| 
      
 56 
     | 
    
         
            +
                :created => 1371945005,
         
     | 
| 
      
 57 
     | 
    
         
            +
                :available_on => 1372549805,
         
     | 
| 
      
 58 
     | 
    
         
            +
                :status => "pending",
         
     | 
| 
      
 59 
     | 
    
         
            +
                :description => "A test balance transaction",
         
     | 
| 
      
 60 
     | 
    
         
            +
                :fee => 59,
         
     | 
| 
      
 61 
     | 
    
         
            +
                :object => "balance_transaction"
         
     | 
| 
      
 62 
     | 
    
         
            +
              }.merge(params)
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            def test_balance_transaction_array
         
     | 
| 
      
 66 
     | 
    
         
            +
              {
         
     | 
| 
      
 67 
     | 
    
         
            +
                :data => [test_balance_transaction, test_balance_transaction, test_balance_transaction],
         
     | 
| 
      
 68 
     | 
    
         
            +
                :object => "list",
         
     | 
| 
      
 69 
     | 
    
         
            +
                :url => "/v1/balance/history"
         
     | 
| 
      
 70 
     | 
    
         
            +
              }
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       37 
73 
     | 
    
         
             
            def test_customer(params={})
         
     | 
| 
       38 
74 
     | 
    
         
             
              {
         
     | 
| 
       39 
75 
     | 
    
         
             
                :subscription_history => [],
         
     | 
    
        data/test/test_stripe.rb
    CHANGED
    
    | 
         @@ -351,6 +351,26 @@ class TestStripeRuby < Test::Unit::TestCase 
     | 
|
| 
       351 
351 
     | 
    
         
             
                    end
         
     | 
| 
       352 
352 
     | 
    
         
             
                  end
         
     | 
| 
       353 
353 
     | 
    
         | 
| 
      
 354 
     | 
    
         
            +
                  context "balance tests" do
         
     | 
| 
      
 355 
     | 
    
         
            +
                    should "balance should be retrievable" do
         
     | 
| 
      
 356 
     | 
    
         
            +
                      @mock.expects(:get).once.returns(test_response(test_balance))
         
     | 
| 
      
 357 
     | 
    
         
            +
                      b = Stripe::Balance.retrieve
         
     | 
| 
      
 358 
     | 
    
         
            +
                      assert_equal 12345, b.pending.first.amount
         
     | 
| 
      
 359 
     | 
    
         
            +
                      assert_equal 6789, b.available.first.amount
         
     | 
| 
      
 360 
     | 
    
         
            +
                    end
         
     | 
| 
      
 361 
     | 
    
         
            +
                  end
         
     | 
| 
      
 362 
     | 
    
         
            +
             
     | 
| 
      
 363 
     | 
    
         
            +
                  context "balance transaction tests" do
         
     | 
| 
      
 364 
     | 
    
         
            +
                    should "balance transactions should be listable" do
         
     | 
| 
      
 365 
     | 
    
         
            +
                      @mock.expects(:get).once.returns(test_response(test_balance_transaction_array))
         
     | 
| 
      
 366 
     | 
    
         
            +
                      bt = Stripe::BalanceTransaction.all
         
     | 
| 
      
 367 
     | 
    
         
            +
                      assert bt.data.kind_of?(Array)
         
     | 
| 
      
 368 
     | 
    
         
            +
                      bt.each do |balance_transaction|
         
     | 
| 
      
 369 
     | 
    
         
            +
                        assert balance_transaction.kind_of?(Stripe::BalanceTransaction)
         
     | 
| 
      
 370 
     | 
    
         
            +
                      end
         
     | 
| 
      
 371 
     | 
    
         
            +
                    end
         
     | 
| 
      
 372 
     | 
    
         
            +
                  end
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
       354 
374 
     | 
    
         
             
                  context "list tests" do
         
     | 
| 
       355 
375 
     | 
    
         
             
                    should "be able to retrieve full lists given a listobject" do
         
     | 
| 
       356 
376 
     | 
    
         
             
                      @mock.expects(:get).twice.returns(test_response(test_charge_array))
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: stripe
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.8. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.8.6
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2013-08- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2013-08-20 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: rest-client
         
     | 
| 
         @@ -145,6 +145,8 @@ files: 
     | 
|
| 
       145 
145 
     | 
    
         
             
            - lib/stripe/api_operations/list.rb
         
     | 
| 
       146 
146 
     | 
    
         
             
            - lib/stripe/api_operations/update.rb
         
     | 
| 
       147 
147 
     | 
    
         
             
            - lib/stripe/api_resource.rb
         
     | 
| 
      
 148 
     | 
    
         
            +
            - lib/stripe/balance.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - lib/stripe/balance_transaction.rb
         
     | 
| 
       148 
150 
     | 
    
         
             
            - lib/stripe/card.rb
         
     | 
| 
       149 
151 
     | 
    
         
             
            - lib/stripe/charge.rb
         
     | 
| 
       150 
152 
     | 
    
         
             
            - lib/stripe/coupon.rb
         
     |