Class: Fulfillment::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fulfillment/client.rb

Instance Method Summary collapse

Instance Method Details

#call(method, path, params = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/fulfillment/client.rb', line 14

def call(method, path, params={})
  raw_response = connection.public_send(method, path, params) do |req|
    req.options.timeout = params[:query]&.delete(:request_timeout) || 30
  end
  Response.new(raw_response)
end

#connectionObject



6
7
8
9
10
11
12
# File 'lib/fulfillment/client.rb', line 6

def connection
  @connection ||= Faraday.new(proxy: config.proxy) do |conn|
    conn.request :json
    conn.response :json
    conn.adapter Faraday.default_adapter
  end
end