Sha256: 201086270f6db2c9277fc8b7703aa7421d2cfc502c67ff62c4bdb3b7e679313a
Contents?: true
Size: 1.26 KB
Versions: 5
Compression:
Stored size: 1.26 KB
Contents
module Experian class Client include Experian::HTTP TRADE_REPORT = 388 CREDIT_REPORT = 57 CONFIG_KEYS = %i[ user_code password request_timeout base_uri extra_headers ].freeze attr_reader(*CONFIG_KEYS, :faraday_middleware) def initialize(config = {}, &faraday_middleware) CONFIG_KEYS.each do |key| # Set instance variables like api_type & access_token. Fall back to global config # if not present. instance_variable_set("@#{key}", config[key] || Experian.configuration.send(key)) end @faraday_middleware = faraday_middleware end def credit_report(cif:, format: :xml, as_response: false) response = get( path: "/informe", format:, cif:, cod_servicio: CREDIT_REPORT ) return Experian::CreditReport.new(response) if format == :xml && !as_response response end def trade_report(cif:, format: :xml, request_update: true, as_response: false) response = get( path: "/informe", format:, cif:, garantizar_bajo_demanda: request_update ? 1 : 0, cod_servicio: TRADE_REPORT, ) return Experian::TradeReport.new(response) if format == :xml && !as_response response end end end
Version data entries
5 entries across 5 versions & 1 rubygems