Class: Spree::Conekta::CreditCardCollection
- Inherits:
-
Object
- Object
- Spree::Conekta::CreditCardCollection
- Extended by:
- Forwardable
- Includes:
- Enumerable, Client
- Defined in:
- lib/spree/conekta/credit_card_collection.rb
Constant Summary
Constants included from Client
Spree::Conekta::Client::CONEKTA_API
Instance Attribute Summary collapse
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
Attributes included from Client
Instance Method Summary collapse
- #add(token) ⇒ Object
- #endpoint ⇒ Object
-
#initialize(customer, options) ⇒ CreditCardCollection
constructor
A new instance of CreditCardCollection.
Methods included from Client
#connection, #get, #headers, #post
Constructor Details
#initialize(customer, options) ⇒ CreditCardCollection
Returns a new instance of CreditCardCollection.
13 14 15 16 17 |
# File 'lib/spree/conekta/credit_card_collection.rb', line 13 def initialize(customer, ) @customer = customer @auth_token = [:auth_token] @cards = build_cards(get) end |
Instance Attribute Details
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
11 12 13 |
# File 'lib/spree/conekta/credit_card_collection.rb', line 11 def customer @customer end |
Instance Method Details
#add(token) ⇒ Object
19 20 21 |
# File 'lib/spree/conekta/credit_card_collection.rb', line 19 def add(token) @cards << Spree::Conekta::CreditCard.create(customer, token, auth_token) end |
#endpoint ⇒ Object
23 24 25 |
# File 'lib/spree/conekta/credit_card_collection.rb', line 23 def endpoint "customers/#{customer.id}/cards" end |