Module: CreditCardInfo
- Defined in:
- lib/credit_card_info/providers/binlist.rb,
lib/credit_card_info.rb,
lib/credit_card_info/cache.rb,
lib/credit_card_info/proxy.rb,
lib/credit_card_info/config.rb,
lib/credit_card_info/version.rb,
lib/credit_card_info/response.rb,
lib/credit_card_info/providers/bincodes.rb,
lib/credit_card_info/providers/credit_card_bins.rb
Overview
{
"number": {
"length": 16,
"luhn": true
},
"scheme": "visa",
"type": "debit",
"brand": "Visa/Dankort",
"prepaid": false,
"country": {
"numeric": "208",
"alpha2": "DK",
"name": "Denmark",
"emoji": "🇩🇰",
"currency": "DKK",
"latitude": 56,
"longitude": 10
},
"bank": {
"name": "Jyske Bank",
"url": "www.jyskebank.dk",
"phone": "+4589893300",
"city": "Hjørring"
}
}
Defined Under Namespace
Modules: Providers, Proxy Classes: Cache, Config, Error, Response
Constant Summary collapse
- VERSION =
"0.2.0"
- INFO_METHODS =
%i[ bin bank card type level country countrycode ].freeze
Class Method Summary collapse
- .config ⇒ Object
-
.extract_bin(value) ⇒ String
First 5 digits of credit card number i.e.
- .fetch(value) ⇒ Object
- .logger ⇒ Object
Class Method Details
.config ⇒ Object
12 13 14 |
# File 'lib/credit_card_info.rb', line 12 def self.config @config ||= Config.config end |
.extract_bin(value) ⇒ String
Returns first 5 digits of credit card number i.e. BIN.
26 27 28 |
# File 'lib/credit_card_info.rb', line 26 def self.extract_bin(value) value.to_s.delete("\s")[0..5] end |
.fetch(value) ⇒ Object
16 17 18 19 |
# File 'lib/credit_card_info.rb', line 16 def self.fetch(value) code = extract_bin(value) Cache.fetch(code) { Proxy.fetch(code) } end |
.logger ⇒ Object
21 22 23 |
# File 'lib/credit_card_info.rb', line 21 def self.logger @logger ||= config.logger end |