Class: VSafe::CardType

Inherits:
Object
  • Object
show all
Defined in:
lib/vsafe/card_type.rb

Constant Summary collapse

AMERICAN_EXPRESS =
3
VISA =
4
MASTERCARD =
5
DISCOVER =
6
DINERS_CLUB =
7
OPTIMA =
10
HUMANIZED_NAMES =
{
  AMERICAN_EXPRESS => "American Express".freeze,
  VISA => "Visa".freeze,
  MASTERCARD => "MasterCard".freeze,
  DISCOVER => "Discover".freeze,
  DINERS_CLUB => "Diners Club".freeze,
  OPTIMA => "Optima".freeze
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ CardType

Returns a new instance of CardType.



21
22
23
# File 'lib/vsafe/card_type.rb', line 21

def initialize(code)
  @code = code.to_i
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



19
20
21
# File 'lib/vsafe/card_type.rb', line 19

def code
  @code
end

Instance Method Details

#descriptionObject



25
26
27
# File 'lib/vsafe/card_type.rb', line 25

def description
  HUMANIZED_NAMES[code]
end