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.



406
407
408
409
# File 'lib/active_merchant/billing/credit_card.rb', line 406

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

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



405
406
407
# File 'lib/active_merchant/billing/credit_card.rb', line 405

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



405
406
407
# File 'lib/active_merchant/billing/credit_card.rb', line 405

def year
  @year
end

Instance Method Details

#expirationObject

:nodoc:



415
416
417
418
419
420
421
# File 'lib/active_merchant/billing/credit_card.rb', line 415

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

#expired?Boolean

:nodoc:

Returns:

  • (Boolean)


411
412
413
# File 'lib/active_merchant/billing/credit_card.rb', line 411

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