Class: Experian::Client
Constant Summary collapse
- TRADE_REPORT =
388
- CREDIT_REPORT =
57
- CONFIG_KEYS =
%i[ user_code password request_timeout base_uri extra_headers ].freeze
Instance Method Summary collapse
- #credit_report(cif:, format: :xml, as_response: false) ⇒ Object
-
#initialize(config = {}, &faraday_middleware) ⇒ Client
constructor
A new instance of Client.
- #trade_report(cif:, format: :xml, request_update: true, as_response: false) ⇒ Object
Methods included from HTTP
Constructor Details
#initialize(config = {}, &faraday_middleware) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 |
# File 'lib/experian/client.rb', line 13 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 |
Instance Method Details
#credit_report(cif:, format: :xml, as_response: false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/experian/client.rb', line 22 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 |
#trade_report(cif:, format: :xml, request_update: true, as_response: false) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/experian/client.rb', line 35 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 |