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

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(month, year) ⇒ ExpiryDate

Returns a new instance of ExpiryDate.



373
374
375
376
# File 'lib/active_merchant/billing/credit_card.rb', line 373

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

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



372
373
374
# File 'lib/active_merchant/billing/credit_card.rb', line 372

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



372
373
374
# File 'lib/active_merchant/billing/credit_card.rb', line 372

def year
  @year
end

Instance Method Details

#expirationObject

:nodoc:



382
383
384
385
386
# File 'lib/active_merchant/billing/credit_card.rb', line 382

def expiration #:nodoc:
  Time.utc(year, month, month_days, 23, 59, 59)
rescue ArgumentError
  Time.at(0).utc
end

#expired?Boolean

:nodoc:

Returns:

  • (Boolean)


378
379
380
# File 'lib/active_merchant/billing/credit_card.rb', line 378

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