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.
431 432 433 434 |
# File 'lib/active_merchant/billing/credit_card.rb', line 431 def initialize(month, year) @month = month.to_i @year = year.to_i end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
429 430 431 |
# File 'lib/active_merchant/billing/credit_card.rb', line 429 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
429 430 431 |
# File 'lib/active_merchant/billing/credit_card.rb', line 429 def year @year end |
Instance Method Details
#expiration ⇒ Object
:nodoc:
440 441 442 443 444 |
# File 'lib/active_merchant/billing/credit_card.rb', line 440 def expiration #:nodoc: Time.utc(year, month, month_days, 23, 59, 59) rescue ArgumentError Time.at(0).utc end |
#expired? ⇒ Boolean
:nodoc:
436 437 438 |
# File 'lib/active_merchant/billing/credit_card.rb', line 436 def expired? #:nodoc: Time.now.utc > expiration end |