Class: PinPayment::Card
Instance Attribute Summary collapse
-
#address_city ⇒ Object
readonly
Returns the value of attribute address_city.
-
#address_country ⇒ Object
readonly
Returns the value of attribute address_country.
-
#address_line1 ⇒ Object
readonly
Returns the value of attribute address_line1.
-
#address_line2 ⇒ Object
readonly
Returns the value of attribute address_line2.
-
#address_postcode ⇒ Object
readonly
Returns the value of attribute address_postcode.
-
#address_state ⇒ Object
readonly
Returns the value of attribute address_state.
-
#display_number ⇒ Object
readonly
Returns the value of attribute display_number.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
-
.create(card_data) ⇒ PinPayment::Card
Use the pin API to create a credit card token, usable for 1 month from creation.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from PinPayment::Base
Instance Attribute Details
#address_city ⇒ Object
Returns the value of attribute address_city.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_city @address_city end |
#address_country ⇒ Object
Returns the value of attribute address_country.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_country @address_country end |
#address_line1 ⇒ Object
Returns the value of attribute address_line1.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_line1 @address_line1 end |
#address_line2 ⇒ Object
Returns the value of attribute address_line2.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_line2 @address_line2 end |
#address_postcode ⇒ Object
Returns the value of attribute address_postcode.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_postcode @address_postcode end |
#address_state ⇒ Object
Returns the value of attribute address_state.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def address_state @address_state end |
#display_number ⇒ Object
Returns the value of attribute display_number.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def display_number @display_number end |
#scheme ⇒ Object
Returns the value of attribute scheme.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def scheme @scheme end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/pin_payment/card.rb', line 3 def token @token end |
Class Method Details
.create(card_data) ⇒ PinPayment::Card
Use the pin API to create a credit card token, usable for 1 month from creation.
24 25 26 27 28 29 |
# File 'lib/pin_payment/card.rb', line 24 def self.create card_data attributes = self.attributes - [:token, :display_number, :scheme] # fix attributes allowed by POST API = (attributes, card_data) response = post(URI.parse(PinPayment.api_url).tap{|uri| uri.path = '/1/cards' }, ) new(response.delete('token'), response) end |
Instance Method Details
#to_hash ⇒ Hash
32 33 34 |
# File 'lib/pin_payment/card.rb', line 32 def to_hash {}.tap{|h| self.class.attributes.each{|k| v = send(k) ; h[k] = v if v }} end |