Sha256: dbd98c0a1e8db9a62eee713ddde90b651e8387bedae4d72741f8d366f4cd241b

Contents?: true

Size: 1.13 KB

Versions: 44

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

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

    OBJECT_NAME = "bank_account".freeze

    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, "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, "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

44 entries across 44 versions & 1 rubygems

Version Path
stripe-4.16.0 lib/stripe/bank_account.rb
stripe-4.15.0 lib/stripe/bank_account.rb
stripe-4.14.0 lib/stripe/bank_account.rb
stripe-4.13.0 lib/stripe/bank_account.rb
stripe-4.12.0 lib/stripe/bank_account.rb
stripe-4.11.0 lib/stripe/bank_account.rb
stripe-4.10.0 lib/stripe/bank_account.rb
stripe-4.9.1 lib/stripe/bank_account.rb
stripe-4.9.0 lib/stripe/bank_account.rb
stripe-4.8.1 lib/stripe/bank_account.rb
stripe-4.8.0 lib/stripe/bank_account.rb
stripe-4.7.1 lib/stripe/bank_account.rb
stripe-4.7.0 lib/stripe/bank_account.rb
stripe-4.6.0 lib/stripe/bank_account.rb
stripe-4.5.0 lib/stripe/bank_account.rb
stripe-4.4.1 lib/stripe/bank_account.rb
stripe-4.4.0 lib/stripe/bank_account.rb
stripe-4.3.0 lib/stripe/bank_account.rb
stripe-4.2.0 lib/stripe/bank_account.rb
stripe-4.1.0 lib/stripe/bank_account.rb