Module: Experian::HTTP

Included in:
Client
Defined in:
lib/experian/http.rb

Instance Method Summary collapse

Instance Method Details

#get(path:, format:, **query) ⇒ Object

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/experian/http.rb', line 9

def get(path:, format:, **query)
  tip_formato = {
    xml: 2,
    pdf: 3
  }[format]

  raise Experian::Error, "Invalid format: #{format}" unless tip_formato

  query.merge!(tip_formato:)
  full_uri = uri(path:, query:)

  if format == :xml
    return conn.get(full_uri) do |req|
      req.headers = headers
    end
  end

  full_uri
end