Class: CreditCardInfo::Providers::CreditCardBins
- Inherits:
-
Object
- Object
- CreditCardInfo::Providers::CreditCardBins
- Defined in:
- lib/credit_card_info/providers/credit_card_bins.rb
Class Method Summary collapse
Class Method Details
.fetch(code) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/credit_card_info/providers/credit_card_bins.rb', line 8 def self.fetch(code) bin = CreditCardBin.new(code) CreditCardInfo::Response.new( data: { bin: bin.bin, bank: bin.issuer, card: bin.brand, type: bin.type, level: bin.category, country: bin.data.dig("country", "name"), countrycode: bin.data.dig("country", "alpha_2") } ) rescue StandardError => e CreditCardInfo::Response.new(error: { code: e.class, message: e. }) end |