Class: Experian::Client

Inherits:
Object
  • Object
show all
Includes:
HTTP
Defined in:
lib/experian/client.rb

Constant Summary collapse

CONFIG_KEYS =
%i[
  user_code password request_timeout base_uri extra_headers
].freeze

Instance Method Summary collapse

Methods included from HTTP

#get

Constructor Details

#initialize(config = {}, &faraday_middleware) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
17
# File 'lib/experian/client.rb', line 10

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

#report(cif:, format: :xml) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/experian/client.rb', line 19

def report(cif:, format: :xml)
  response = get(path: "/informe", format:, cif:, cod_servicio: 57)

  return Experian::Report.new(response) if format == :xml

  response
end