class CreditCardBins::Bin
Constants
- AttrReaders
Attributes
data[R]
Public Class Methods
new(number)
click to toggle source
# File lib/credit_card_bins/bin.rb, line 22 def initialize(number) @data = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'data', number[0].to_s, number[0..3].to_s + '.yml' ))[number.to_s[0..5]] rescue raise NotFound, "Bin #{number} not found" end
Public Instance Methods
==(other)
click to toggle source
# File lib/credit_card_bins/bin.rb, line 28 def ==(other) self.data == other.data end
amex?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 58 def amex? @data["brand"] == "AMERICAN EXPRESS" end
atm?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 82 def atm? @data["brand"] == "ATM" end
brand()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 32 def brand @data["brand"].to_s end
category()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 40 def category @data["category"].to_s end
china_union_pay?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 62 def china_union_pay? @data["brand"] == "CHINA UNION PAY" end
country()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 48 def country @data["country"] end
credit?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 112 def credit? @data["type"] == "CREDIT" end
dankort?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 86 def dankort? @data["brand"] == "DANKORT" end
debit?()
click to toggle source
Type
# File lib/credit_card_bins/bin.rb, line 108 def debit? @data["type"] == "DEBIT" end
diners_club?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 102 def diners_club? @data["brand"] == "DINERS CLUB" end
discover?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 74 def discover? @data["brand"] == "DISCOVER" end
issuer()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 44 def issuer @data["issuer"].to_s end
jcb?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 70 def jcb? @data["brand"] == "JCB" end
laser?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 94 def laser? @data["brand"] == "LASER" end
maestro?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 78 def maestro? @data["brand"] == "MAESTRO" end
mastercard?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 90 def mastercard? @data["brand"] == "MASTERCARD" end
prepaid?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 116 def prepaid? @data["type"] == "PREPAID" end
private_label?()
click to toggle source
Brand
# File lib/credit_card_bins/bin.rb, line 54 def private_label? @data["brand"] == "PRIVATE LABEL" end
solo?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 98 def solo? @data["brand"] == "SOLO" end
type()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 36 def type @data["type"].to_s end
visa?()
click to toggle source
# File lib/credit_card_bins/bin.rb, line 66 def visa? @data["brand"] == "VISA" end