lib/firstclasspostcodes/client.rb
# The Configuration object holding settings to be used in the API client.
The Configuration object holding settings to be used in the API client.
The Configuration object holding settings to be used in the API client .
def request(opts)
      url = build_request_url(opts[:path])
      request_params = {
        params: opts[:query_params] || {},
        method: opts[:method].to_sym.downcase,
      }
      request_params.merge!(@config.to_request_params)
      emit("request", request_params)
      response = call_request(url, request_params)
      data = JSON.parse(response.body, symbolize_names: true)
      emit("response", data)
      data
    rescue ResponseError => e
      emit("error", e)
      raise e
    end
def request ( opts ) url = build_request_url ( opts [ :path ] ) request_params = { params : opts [ :query_params ] || { } , method : opts [ :method ] . to_sym . downcase , } request_params . merge! ( @config . to_request_params ) emit ( "request" , request_params ) response = call_request ( url , request_params ) data = JSON . parse ( response . body , symbolize_names : true ) emit ( "response" , data ) data rescue ResponseError => e emit ( "error" , e ) raise e end
The Configuration object holding settings to be used in the API client.
The Configuration object holding settings to be used in the API client .
opts
<not_specific>