Sha256: 7ca627fb84adf896e91791efbcf32b2d6b145996d21d0b54035d6beaf9799cbe
Contents?: true
Size: 549 Bytes
Versions: 3
Compression:
Stored size: 549 Bytes
Contents
# frozen_string_literal: true module CreditCardInfo Response = Struct.new(:error, :data, keyword_init: true) INFO_METHODS = %i[ bin bank card type level country countrycode ].freeze class Response INFO_METHODS.each do |m| define_method(m) { data.fetch(m, "") } end def valid? error.nil? end def log_error return unless CreditCardInfo.logger CreditCardInfo.logger.warn "Wrong response: error_code=#{error[:code]} error_message=#{error[:message]}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
credit_card_info-0.2.0 | lib/credit_card_info/response.rb |
credit_card_info-0.1.1 | lib/credit_card_info/response.rb |
credit_card_info-0.1.0 | lib/credit_card_info/response.rb |