fanforce 0.3.18 → 0.3.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fanforce/errors.rb +6 -1
- data/lib/fanforce/main.rb +2 -2
- data/lib/fanforce/version.rb +1 -1
- metadata +1 -1
data/lib/fanforce/errors.rb
CHANGED
@@ -39,5 +39,10 @@ class Fanforce
|
|
39
39
|
class ForbiddenError < Error; def code() 403 end end
|
40
40
|
class NotFoundError < Error; def code() 404 end end
|
41
41
|
class UnprocessableEntityError < Error; def code() 422 end end
|
42
|
-
class UnknownError < Error;
|
42
|
+
class UnknownError < Error;
|
43
|
+
def code() @code ||= 500 end
|
44
|
+
def initialize(response, request, path, query_params)
|
45
|
+
@code = response.code
|
46
|
+
end
|
47
|
+
end
|
43
48
|
end
|
data/lib/fanforce/main.rb
CHANGED
@@ -39,7 +39,7 @@ class Fanforce
|
|
39
39
|
def post(path, req_params={})
|
40
40
|
url = complete_url(path)
|
41
41
|
req_params = apply_auth(req_params)
|
42
|
-
RestClient.post(url, req_params,
|
42
|
+
RestClient.post(url, req_params.to_json, :content_type => :json, :accept => :json) do |response, request, result, &block|
|
43
43
|
handle_response(response, request, url, req_params)
|
44
44
|
end
|
45
45
|
end
|
@@ -47,7 +47,7 @@ class Fanforce
|
|
47
47
|
def put(path, req_params={})
|
48
48
|
url = complete_url(path)
|
49
49
|
req_params = apply_auth(req_params)
|
50
|
-
RestClient.put(url, req_params,
|
50
|
+
RestClient.put(url, req_params.to_json, :content_type => :json, :accept => :json) do |response, request, result, &block|
|
51
51
|
handle_response(response, request, url, req_params)
|
52
52
|
end
|
53
53
|
end
|
data/lib/fanforce/version.rb
CHANGED