Sha256: 28fdeea968d3aba98ea378c3b075e810f431a04902c550ae703db91b5688a466

Contents?: true

Size: 771 Bytes

Versions: 9

Compression:

Stored size: 771 Bytes

Contents

module Stripe
  class Card < APIResource
    include Stripe::APIOperations::Update
    include Stripe::APIOperations::Delete
    extend Stripe::APIOperations::List

    def resource_url
      if respond_to?(:recipient)
        "#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
      elsif 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.retrieve(id, opts=nil)
      raise NotImplementedError.new("Cards cannot be retrieved without a customer ID. Retrieve a card using customer.sources.retrieve('card_id')")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stripe-1.43.1 lib/stripe/card.rb
stripe-1.43.0 lib/stripe/card.rb
stripe-1.42.0 lib/stripe/card.rb
stripe-1.41.0 lib/stripe/card.rb
stripe-1.40.0 lib/stripe/card.rb
stripe-1.39.0 lib/stripe/card.rb
stripe-1.38.0 lib/stripe/card.rb
stripe-1.37.0 lib/stripe/card.rb
stripe-1.36.2 lib/stripe/card.rb