Class: ActiveMerchant::Billing::CreditCard::ExpiryDate
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::CreditCard::ExpiryDate
- Defined in:
- lib/active_merchant/billing/credit_card.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#expiration ⇒ Object
:nodoc:.
-
#expired? ⇒ Boolean
:nodoc:.
-
#initialize(month, year) ⇒ ExpiryDate
constructor
A new instance of ExpiryDate.
Constructor Details
#initialize(month, year) ⇒ ExpiryDate
Returns a new instance of ExpiryDate.
58 59 60 61 |
# File 'lib/active_merchant/billing/credit_card.rb', line 58 def initialize(month, year) @month = ExpiryMonth.new(month) @year = ExpiryYear.new(year) end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
57 58 59 |
# File 'lib/active_merchant/billing/credit_card.rb', line 57 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
57 58 59 |
# File 'lib/active_merchant/billing/credit_card.rb', line 57 def year @year end |
Instance Method Details
#expiration ⇒ Object
:nodoc:
67 68 69 |
# File 'lib/active_merchant/billing/credit_card.rb', line 67 def expiration #:nodoc: Time.parse("#{month}/#{month_days}/#{year} 23:59:59") rescue Time.at(0) end |
#expired? ⇒ Boolean
:nodoc:
63 64 65 |
# File 'lib/active_merchant/billing/credit_card.rb', line 63 def expired? #:nodoc: Time.now > expiration rescue true end |