Module: Crowdkit::API::RequestMethods

Included in:
Crowdkit::API, ResponseWrapper
Defined in:
lib/crowdkit/api/request_methods.rb

Instance Method Summary collapse

Instance Method Details

#agentObject



15
16
17
18
# File 'lib/crowdkit/api/request_methods.rb', line 15

def agent
  raise Crowdkit::Unauthorized unless config.access_token
  @agent ||= Sawyer::Agent.new(config.api_endpoint, sawyer_options)
end

#methodSawyer::Resource

Make an HTTP request

Parameters:

  • url (String)

    The path, relative to #api_endpoint

  • options (Hash)

    Query and header params for request

Returns:

  • (Sawyer::Resource)


9
10
11
12
13
# File 'lib/crowdkit/api/request_methods.rb', line 9

[:get,:post,:put,:patch,:delete,:head].each do |method|
  define_method("do_#{method}") do |url, data = {}, options = {}|
    request method, url, data, options
  end
end