lib/fanforce/api/_main.rb in fanforce-api-0.14.8 vs lib/fanforce/api/_main.rb in fanforce-api-0.14.9
- old
+ new
@@ -43,11 +43,11 @@
def post(path, req_params={}, retries=0)
url = complete_url(path)
req_params = apply_auth(req_params) unless retries > 0
RestClient.post(url, MultiJson.dump(req_params), :content_type => :json, :accept => :json) do |response, request, result, &block|
if response.code == 400 and response.body == '{"error":"Invalid JSON"}' and retries <= 2
- puts "retried #{path} #{retries} times"
+ puts "retried #{path} #{retries+1} times"
post(path, req_params, retries+1)
else
Fanforce::API::Response.process(response, request, url, req_params)
end
end
@@ -56,10 +56,10 @@
def put(path, req_params={}, retries=0)
url = complete_url(path)
req_params = apply_auth(req_params) unless retries > 0
RestClient.put(url, MultiJson.dump(req_params), :content_type => :json, :accept => :json) do |response, request, result, &block|
if response.code == 400 and response.body == '{"error":"Invalid JSON"}' and retries <= 2
- puts "retried #{path} #{retries} times"
+ puts "retried #{path} #{retries+1} times"
post(path, req_params, retries+1)
else
Fanforce::API::Response.process(response, request, url, req_params)
end
end