Sha256: d4d5802b2a32134843166c30873a4607b4dc9efa946b8fa56c0b65b9899b28d0

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

module Stripe
  class BankAccount < APIResource
    include Stripe::APIOperations::Save
    include Stripe::APIOperations::Delete
    extend Stripe::APIOperations::List

    OBJECT_NAME = 'bank_account'

    def verify(params={}, opts={})
      resp, opts = request(:post, resource_url + '/verify', params, opts)
      initialize_from(resp.data, opts)
    end

    def resource_url
      if respond_to?(:customer)
        "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
      elsif respond_to?(:account)
        "#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
      end
    end

    def self.update(id, params=nil, opts=nil)
      raise NotImplementedError.new("Bank accounts cannot be updated without an account ID. Update a bank account by using `a = account.external_accounts.retrieve('card_id'); a.save`")
    end

    def self.retrieve(id, opts=nil)
      raise NotImplementedError.new("Bank accounts cannot be retrieved without an account ID. Retrieve a bank account using account.external_accounts.retrieve('card_id')")
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
stripe-3.3.2 lib/stripe/bank_account.rb
stripe-3.3.1 lib/stripe/bank_account.rb
stripe-3.3.0 lib/stripe/bank_account.rb
stripe-3.2.0 lib/stripe/bank_account.rb
stripe-3.1.0 lib/stripe/bank_account.rb
stripe-3.0.3 lib/stripe/bank_account.rb
stripe-3.0.1 lib/stripe/bank_account.rb
stripe-3.0.0 lib/stripe/bank_account.rb
stripe-2.12.0 lib/stripe/bank_account.rb
stripe-2.11.0 lib/stripe/bank_account.rb
stripe-2.10.0 lib/stripe/bank_account.rb
stripe-2.9.0 lib/stripe/bank_account.rb
stripe-2.8.0 lib/stripe/bank_account.rb
stripe-2.7.0 lib/stripe/bank_account.rb
stripe-2.6.0 lib/stripe/bank_account.rb