Sha256: 2ac9281cc0e005081562a43444739755c605233ec3e4bc4a29e0c180a0d5d544

Contents?: true

Size: 981 Bytes

Versions: 25

Compression:

Stored size: 981 Bytes

Contents

module Stripe
  class Card < APIResource
    include Stripe::APIOperations::Save
    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.update(id, params=nil, opts=nil)
      raise NotImplementedError.new("Cards cannot be updated without a customer ID. Update a card using `c = customer.sources.retrieve('card_id'); c.save`")
    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

25 entries across 25 versions & 1 rubygems

Version Path
stripe-2.0.3 lib/stripe/card.rb
stripe-2.0.2 lib/stripe/card.rb
stripe-2.0.1 lib/stripe/card.rb
stripe-2.0.0 lib/stripe/card.rb
stripe-1.58.0 lib/stripe/card.rb
stripe-1.57.1 lib/stripe/card.rb
stripe-1.57.0 lib/stripe/card.rb
stripe-1.56.2 lib/stripe/card.rb
stripe-1.56.1 lib/stripe/card.rb
stripe-1.56.0 lib/stripe/card.rb
stripe-1.55.1 lib/stripe/card.rb
stripe-1.55.0 lib/stripe/card.rb
stripe-1.54.0 lib/stripe/card.rb
stripe-1.53.0 lib/stripe/card.rb
stripe-1.52.0 lib/stripe/card.rb
stripe-1.51.1 lib/stripe/card.rb
stripe-1.51.0 lib/stripe/card.rb
stripe-1.50.1 lib/stripe/card.rb
stripe-1.50.0 lib/stripe/card.rb
stripe-1.49.0 lib/stripe/card.rb