fanforce 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fanforce/errors.rb +6 -5
- data/lib/fanforce/version.rb +1 -1
- metadata +1 -1
data/lib/fanforce/errors.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
class Fanforce
|
2
2
|
class Error < StandardError;
|
3
|
+
attr_accessor :path, :query_params, :request, :response, :request_url
|
4
|
+
|
3
5
|
def initialize(response, request, path, query_params)
|
4
6
|
@query_params = query_params
|
5
7
|
@path = path
|
6
8
|
@request = request
|
7
9
|
begin
|
8
|
-
@response = MultiJson.load(response, :symbolize_keys =>
|
9
|
-
rescue
|
10
|
-
@response =
|
10
|
+
@response = MultiJson.load(response, :symbolize_keys => true)
|
11
|
+
rescue Exception => e
|
12
|
+
@response = "JSON decode error in Gem: #{e.message}"
|
11
13
|
end
|
12
14
|
@request_url = "#{@path}?#{@query_params.to_param}"
|
13
|
-
super(@response.is_a?(Hash) ? @response[:
|
15
|
+
super(@response.is_a?(Hash) ? @response[:msg] : @response)
|
14
16
|
end
|
15
|
-
attr :path, :query_params, :request, :response, :request_url
|
16
17
|
|
17
18
|
def curl_command
|
18
19
|
case @request.method
|
data/lib/fanforce/version.rb
CHANGED