Class: ActiveMerchant::Billing::CreditCard::ExpiryDate

Inherits:
Object
  • Object
show all
Defined in:
lib/active_merchant/billing/expiry_date.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(month, year) ⇒ ExpiryDate

Returns a new instance of ExpiryDate.



6
7
8
9
# File 'lib/active_merchant/billing/expiry_date.rb', line 6

def initialize(month, year)
  @month = month
  @year = year
end

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



5
6
7
# File 'lib/active_merchant/billing/expiry_date.rb', line 5

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/active_merchant/billing/expiry_date.rb', line 5

def year
  @year
end

Instance Method Details

#expirationObject

:nodoc:



15
16
17
# File 'lib/active_merchant/billing/expiry_date.rb', line 15

def expiration #:nodoc:
  Time.parse("#{month}/#{month_days}/#{year} 23:59:59") rescue Time.at(0)
end

#expired?Boolean

:nodoc:

Returns:

  • (Boolean)


11
12
13
# File 'lib/active_merchant/billing/expiry_date.rb', line 11

def expired? #:nodoc:
  Time.now > expiration rescue true
end