Class: ActiveMerchant::Billing::CreditCard::ExpiryDate
- Inherits:
-
Object
- Object
- ActiveMerchant::Billing::CreditCard::ExpiryDate
- Defined in:
- lib/active_merchant/billing/expiry_date.rb
Overview
:nodoc:
Instance Attribute Summary (collapse)
-
- (Object) month
readonly
Returns the value of attribute month.
-
- (Object) year
readonly
Returns the value of attribute year.
Instance Method Summary (collapse)
-
- (Object) expiration
:nodoc:.
-
- (Boolean) expired?
:nodoc:.
-
- (ExpiryDate) initialize(month, year)
constructor
A new instance of ExpiryDate.
Constructor Details
- (ExpiryDate) initialize(month, year)
A new instance of ExpiryDate
8 9 10 11 |
# File 'lib/active_merchant/billing/expiry_date.rb', line 8 def initialize(month, year) @month = month.to_i @year = year.to_i end |
Instance Attribute Details
- (Object) month (readonly)
Returns the value of attribute month
7 8 9 |
# File 'lib/active_merchant/billing/expiry_date.rb', line 7 def month @month end |
- (Object) year (readonly)
Returns the value of attribute year
7 8 9 |
# File 'lib/active_merchant/billing/expiry_date.rb', line 7 def year @year end |
Instance Method Details
- (Object) expiration
:nodoc:
17 18 19 20 21 22 23 |
# File 'lib/active_merchant/billing/expiry_date.rb', line 17 def expiration #:nodoc: begin Time.utc(year, month, month_days, 23, 59, 59) rescue ArgumentError Time.at(0).utc end end |
- (Boolean) expired?
:nodoc:
13 14 15 |
# File 'lib/active_merchant/billing/expiry_date.rb', line 13 def expired? #:nodoc: Time.now.utc > expiration end |