fanforce 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -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; def code() 500 end end
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, {:accept => :json}) do |response, request, result, &block|
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, {:accept => :json}) do |response, request, result, &block|
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
@@ -1,3 +1,3 @@
1
1
  class Fanforce
2
- VERSION = "0.3.18"
2
+ VERSION = "0.3.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: