Skip to content

Instantly share code, notes, and snippets.

@antongudkov
Created September 3, 2014 15:01
Show Gist options
  • Save antongudkov/edd9af030571ddfecfa7 to your computer and use it in GitHub Desktop.
Save antongudkov/edd9af030571ddfecfa7 to your computer and use it in GitHub Desktop.
def api_request(action, ndpoint, params)
url = "/api/v#{API_VERSION}/#{endpoint}"
params = fulltext_params_merge(params)
response = http_client.send(:action) do |request|
request.url url, params
set_request_headers(request)
end
response.body
end
def api_request_post(endpoint, params = {})
api_request(:post, endpoint, params)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment