Class: Stripe::Card
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Card
- Extended by:
- APIOperations::List
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/stripe/resources/card.rb
Overview
You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.
Related guide: [Card payments with Sources](stripe.com/docs/sources/cards)
Constant Summary collapse
- OBJECT_NAME =
"card"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Class Method Summary collapse
Instance Method Summary collapse
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods included from APIOperations::Delete
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Class Method Details
.retrieve(_id, _opts = nil) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/stripe/resources/card.rb', line 33 def self.retrieve(_id, _opts = nil) raise NotImplementedError, "Card cannot be retrieved without a customer ID or an account " \ "ID. Retrieve a card using `Customer.retrieve_source(" \ "'customer_id', 'card_id')` or " \ "`Account.retrieve_external_account('account_id', 'card_id')`" end |
.update(_id, _params = nil, _opts = nil) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/stripe/resources/card.rb', line 25 def self.update(_id, _params = nil, _opts = nil) raise NotImplementedError, "Card cannot be updated without a customer ID or an account ID. " \ "Update a card using `Customer.update_source('customer_id', " \ "'card_id', update_params)` or `Account.update_external_account(" \ "'account_id', 'card_id', update_params)`" end |
Instance Method Details
#resource_url ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/stripe/resources/card.rb', line 17 def resource_url if respond_to?(:customer) && !customer.nil? && !customer.empty? "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}" elsif respond_to?(:account) && !account.nil? && !account.empty? "#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}" end end |