arena 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/arena/client.rb +6 -5
- data/lib/arena/version.rb +1 -1
- metadata +1 -1
data/lib/arena/client.rb
CHANGED
@@ -39,7 +39,7 @@ module Arena
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def error?(response)
|
42
|
-
|
42
|
+
response.code != 200
|
43
43
|
end
|
44
44
|
|
45
45
|
def error_message(response)
|
@@ -47,11 +47,12 @@ module Arena
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def request(method, path, options)
|
50
|
-
response =
|
51
|
-
|
52
|
-
|
50
|
+
response = self.class.send(method, "http://#{@base_domain}/#{@api_version}#{path}", options)
|
51
|
+
parsed = JSON.parse(response.body)
|
52
|
+
|
53
|
+
raise Arena::Error.new(error_message(parsed)) if error?(response)
|
53
54
|
|
54
|
-
return
|
55
|
+
return parsed
|
55
56
|
|
56
57
|
rescue JSON::ParserError, TypeError
|
57
58
|
nil
|
data/lib/arena/version.rb
CHANGED