lib/fanforce/api/_main.rb in fanforce-0.7.4 vs lib/fanforce/api/_main.rb in fanforce-0.7.5

- old
+ new

@@ -23,27 +23,27 @@ def add_params(params_to_add) params.merge!(collect_known_params params_to_add) end - def get(path, req_params={}) - req_params = apply_auth(req_params) - RestClient.get(url(path, req_params), :accept => :json) do |response, request, result, &block| - Fanforce::Response.process(response, request, complete_url(path), req_params) - end - end - def url(path, req_params={}) req_params = apply_auth(req_params) "#{complete_url(path)}?#{to_query_string(req_params)}" end def curl_command(method, path, req_params={}) req_params = apply_auth(req_params) Fanforce::Utils.curl_command(method, complete_url(path), req_params) end + def get(path, req_params={}) + req_params = apply_auth(req_params) + RestClient.get(url(path, req_params), :accept => :json) do |response, request, result, &block| + Fanforce::Response.process(response, request, complete_url(path), req_params) + end + end + def post(path, req_params={}) url = complete_url(path) req_params = apply_auth(req_params) RestClient.post(url, req_params.to_json, :content_type => :json, :accept => :json) do |response, request, result, &block| Fanforce::Api::Response.process(response, request, url, req_params) @@ -59,10 +59,10 @@ end def delete(path, req_params={}) url = complete_url(path) req_params = apply_auth(req_params) - RestClient.delete(url, {:params => to_query_string(req_params), :accept => :json}) do |response, request, result, &block| + RestClient.delete(url(path, req_params), :accept => :json) do |response, request, result, &block| Fanforce::Api::Response.process(response, request, url, req_params) end end def identify(req_params)