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



326
327
328
329
# File 'lib/active_merchant/billing/credit_card.rb', line 326

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

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month



325
326
327
# File 'lib/active_merchant/billing/credit_card.rb', line 325

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year



325
326
327
# File 'lib/active_merchant/billing/credit_card.rb', line 325

def year
  @year
end

Instance Method Details

#expirationObject

:nodoc:



335
336
337
338
339
340
341
# File 'lib/active_merchant/billing/credit_card.rb', line 335

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)


331
332
333
# File 'lib/active_merchant/billing/credit_card.rb', line 331

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