Sha256: 67b3e62aa7ecd92b829a57b58521082823d84c1e0721fdee9e91fa86f3f4f597

Contents?: true

Size: 395 Bytes

Versions: 1

Compression:

Stored size: 395 Bytes

Contents

require 'httparty'

module Moocher
  module Creditcard
    def creditcard(cc_number)
      bin = cc_number.to_s.strip[0..5]
      return "Not a Valid input" if (bin =~ /\A\d{6}/).nil?
      base_url = 'https://api.moocher.io/l/BINLISTNET/t/creditcard/i/'
      response = HTTParty.get("#{base_url}#{bin}")
      response.success? ? response.parsed_response : response.success?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moocher-0.3.2 lib/moocher/creditcards.rb