mashery 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/mashery/client.rb +1 -0
- data/lib/mashery/exceptions.rb +3 -0
- data/mashery.gemspec +1 -1
- data/tasks/mashery.thor +2 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/mashery/client.rb
CHANGED
@@ -26,6 +26,7 @@ module Mashery
|
|
26
26
|
end
|
27
27
|
req = ::JSON[{:version => '1.1', :method => method, :params => params, :id => 1}]
|
28
28
|
response = HTTParty.post(signed_uri, :body => req)
|
29
|
+
raise HttpException.new(response.headers['x-mashery-error-code']) unless response.code < 300
|
29
30
|
res = ::JSON[response.body]
|
30
31
|
raise Exception.create(res['error']) if res.include?('error')
|
31
32
|
res['result']
|
data/lib/mashery/exceptions.rb
CHANGED
data/mashery.gemspec
CHANGED
data/tasks/mashery.thor
CHANGED
@@ -29,6 +29,8 @@ module Mashery
|
|
29
29
|
::Mashery.client = ::Mashery::Client.new(site_id, key, secret)
|
30
30
|
begin
|
31
31
|
yield
|
32
|
+
rescue ::Mashery::HttpException => e
|
33
|
+
error("HTTP error: #{e.message}")
|
32
34
|
rescue ::Mashery::JsonRpcException => e
|
33
35
|
error(e.message)
|
34
36
|
rescue ::Mashery::ValidationException => e
|