Class: Pin::Customer

Inherits:
Base
  • Object
show all
Defined in:
lib/pin-payments/customer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

all, find, first, #initialize, last

Constructor Details

This class inherits a constructor from Pin::Base

Instance Attribute Details

#cardObject

Returns the value of attribute card.



3
4
5
# File 'lib/pin-payments/customer.rb', line 3

def card
  @card
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/pin-payments/customer.rb', line 3

def created_at
  @created_at
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/pin-payments/customer.rb', line 3

def email
  @email
end

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/pin-payments/customer.rb', line 3

def token
  @token
end

Class Method Details

.create(email, card_or_token) ⇒ Object

email should be a string card_or_token can be a Pin::Card object or a card_token (as a string)



9
10
11
12
13
14
15
16
17
# File 'lib/pin-payments/customer.rb', line 9

def create(email, card_or_token)
  options = if card_or_token.respond_to?(:to_hash) # card
    {card: card_or_token.to_hash}
  else # token
    {card_token: card_or_token}
  end.merge(email: email)

  super(options)
end