Class: PayTrace::CreditCard
- Inherits:
-
Object
- Object
- PayTrace::CreditCard
- Defined in:
- lib/paytrace/credit_card.rb
Overview
Contains credit card information, including possible swipe data.
Instance Attribute Summary collapse
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#csc ⇒ Object
Returns the value of attribute csc.
-
#expiration_month ⇒ Object
Returns the value of attribute expiration_month.
-
#expiration_year ⇒ Object
Returns the value of attribute expiration_year.
-
#swipe ⇒ Object
Returns the value of attribute swipe.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CreditCard
constructor
Initialize instance; possible options are: * :card_number – the credit card number * :expiration_month – the expiration month of the card * :expiration_year – the expiration year of the card * :csc – the CSC code * :swipe – swipe data, if present All parameters are passed in a hash, with symbols for key names.
-
#set_request_data(request = nil) ⇒ Object
:nodoc: Internal helper method; not meant to be called directly.
Constructor Details
#initialize(options = {}) ⇒ CreditCard
Initialize instance; possible options are:
-
:card_number – the credit card number
-
:expiration_month – the expiration month of the card
-
:expiration_year – the expiration year of the card
-
:csc – the CSC code
-
:swipe – swipe data, if present
All parameters are passed in a hash, with symbols for key names.
13 14 15 16 17 18 19 |
# File 'lib/paytrace/credit_card.rb', line 13 def initialize(={}) @card_number = [:card_number] @expiration_month = [:expiration_month] @expiration_year = [:expiration_year] @swipe = [:swipe] @csc = [:csc] end |
Instance Attribute Details
#card_number ⇒ Object
Returns the value of attribute card_number.
4 5 6 |
# File 'lib/paytrace/credit_card.rb', line 4 def card_number @card_number end |
#csc ⇒ Object
Returns the value of attribute csc.
4 5 6 |
# File 'lib/paytrace/credit_card.rb', line 4 def csc @csc end |
#expiration_month ⇒ Object
Returns the value of attribute expiration_month.
4 5 6 |
# File 'lib/paytrace/credit_card.rb', line 4 def expiration_month @expiration_month end |
#expiration_year ⇒ Object
Returns the value of attribute expiration_year.
4 5 6 |
# File 'lib/paytrace/credit_card.rb', line 4 def expiration_year @expiration_year end |
#swipe ⇒ Object
Returns the value of attribute swipe.
4 5 6 |
# File 'lib/paytrace/credit_card.rb', line 4 def swipe @swipe end |
Instance Method Details
#set_request_data(request = nil) ⇒ Object
:nodoc: Internal helper method; not meant to be called directly.
23 24 25 26 27 28 29 30 |
# File 'lib/paytrace/credit_card.rb', line 23 def set_request_data(request = nil) request ||= PayTrace::API::Request.new request.set_param(:card_number, card_number) if card_number request.set_param(:expiration_month, expiration_month) if expiration_month request.set_param(:expiration_year, expiration_year) if expiration_year request.set_param(:swipe, swipe) if swipe request.set_param(:csc, csc) if csc end |