mashery 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -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']
@@ -9,6 +9,9 @@ module Mashery
9
9
  end
10
10
  end
11
11
 
12
+ class HttpException < Exception
13
+ end
14
+
12
15
  class JsonRpcException < Exception
13
16
  end
14
17
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mashery}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Moseley"]
@@ -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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Moseley