Class: Epay::Card
- Inherits:
-
Object
- Object
- Epay::Card
- Defined in:
- lib/epay/card.rb
Instance Attribute Summary collapse
-
#exp_month ⇒ Object
Returns the value of attribute exp_month.
-
#exp_year ⇒ Object
Returns the value of attribute exp_year.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
- #expires_at ⇒ Object
- #hash ⇒ Object
-
#initialize(attributes = {}) ⇒ Card
constructor
A new instance of Card.
- #last_digits ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Card
Returns a new instance of Card.
5 6 7 8 9 |
# File 'lib/epay/card.rb', line 5 def initialize(attributes = {}) attributes.each do |name, value| self.send("#{name}=", value) if respond_to?("#{name}=") end end |
Instance Attribute Details
#exp_month ⇒ Object
Returns the value of attribute exp_month.
3 4 5 |
# File 'lib/epay/card.rb', line 3 def exp_month @exp_month end |
#exp_year ⇒ Object
Returns the value of attribute exp_year.
3 4 5 |
# File 'lib/epay/card.rb', line 3 def exp_year @exp_year end |
#kind ⇒ Object
Returns the value of attribute kind.
3 4 5 |
# File 'lib/epay/card.rb', line 3 def kind @kind end |
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/epay/card.rb', line 3 def number @number end |
Instance Method Details
#expires_at ⇒ Object
11 12 13 |
# File 'lib/epay/card.rb', line 11 def expires_at Date.new(2000 + exp_year, exp_month, 1).end_of_month end |
#hash ⇒ Object
15 16 17 |
# File 'lib/epay/card.rb', line 15 def hash [number, exp_year, exp_month].join("") if number.present? end |
#last_digits ⇒ Object
19 20 21 |
# File 'lib/epay/card.rb', line 19 def last_digits number[-4, 4] if number.present? end |