Class: Spree::Conekta::CreditCard
- Inherits:
-
Object
- Object
- Spree::Conekta::CreditCard
- Includes:
- Client
- Defined in:
- lib/spree/conekta/credit_card.rb
Constant Summary
Constants included from Client
Spree::Conekta::Client::CONEKTA_API
Instance Attribute Summary collapse
-
#brand ⇒ Object
Returns the value of attribute brand.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last4 ⇒ Object
Returns the value of attribute last4.
Attributes included from Client
Class Method Summary collapse
Instance Method Summary collapse
- #endpoint ⇒ Object
-
#initialize(customer, options) ⇒ CreditCard
constructor
A new instance of CreditCard.
Methods included from Client
#connection, #get, #headers, #post
Constructor Details
#initialize(customer, options) ⇒ CreditCard
Returns a new instance of CreditCard.
17 18 19 20 21 22 |
# File 'lib/spree/conekta/credit_card.rb', line 17 def initialize(customer, ) @customer = customer @auth_token = [:auth_token] build_card([:card]) if [:card] create_card([:token]) if [:token] end |
Instance Attribute Details
#brand ⇒ Object
Returns the value of attribute brand.
7 8 9 |
# File 'lib/spree/conekta/credit_card.rb', line 7 def brand @brand end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
6 7 8 |
# File 'lib/spree/conekta/credit_card.rb', line 6 def customer @customer end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/spree/conekta/credit_card.rb', line 7 def id @id end |
#last4 ⇒ Object
Returns the value of attribute last4.
7 8 9 |
# File 'lib/spree/conekta/credit_card.rb', line 7 def last4 @last4 end |
Class Method Details
.build(customer, card, auth_token) ⇒ Object
13 14 15 |
# File 'lib/spree/conekta/credit_card.rb', line 13 def self.build(customer, card, auth_token) new(customer, card: card, auth_token: auth_token) end |
.create(customer, token, auth_token) ⇒ Object
9 10 11 |
# File 'lib/spree/conekta/credit_card.rb', line 9 def self.create(customer, token, auth_token) new(customer, token: token, auth_token: auth_token) end |
Instance Method Details
#endpoint ⇒ Object
24 25 26 |
# File 'lib/spree/conekta/credit_card.rb', line 24 def endpoint "customers/#{customer.id}/cards" end |