Class: Epay::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/epay/card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Card

Returns a new instance of Card.



5
6
7
8
9
# File 'lib/epay/card.rb', line 5

def initialize(attributes = {})
  attributes.each do |name, value|
    self.send("#{name}=", value) if respond_to?("#{name}=")
  end
end

Instance Attribute Details

#exp_monthObject

Returns the value of attribute exp_month.



3
4
5
# File 'lib/epay/card.rb', line 3

def exp_month
  @exp_month
end

#exp_yearObject

Returns the value of attribute exp_year.



3
4
5
# File 'lib/epay/card.rb', line 3

def exp_year
  @exp_year
end

#kindObject

Returns the value of attribute kind.



3
4
5
# File 'lib/epay/card.rb', line 3

def kind
  @kind
end

#numberObject

Returns the value of attribute number.



3
4
5
# File 'lib/epay/card.rb', line 3

def number
  @number
end

Instance Method Details

#expires_atObject



11
12
13
# File 'lib/epay/card.rb', line 11

def expires_at
  Date.new(2000 + exp_year, exp_month, 1).end_of_month
end

#hashObject



15
16
17
# File 'lib/epay/card.rb', line 15

def hash
  [number, exp_year, exp_month].join("") if number.present?
end

#last_digitsObject



19
20
21
# File 'lib/epay/card.rb', line 19

def last_digits
  number[-4, 4] if number.present?
end