paysio 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.8
1
+ 1.0.9
data/lib/paysio/errors.rb CHANGED
@@ -1,9 +1,29 @@
1
1
  module Paysio
2
2
  module Errors
3
- class Unauthorized < Exception; end;
4
- class InternalError < Exception; end;
5
- class Forbidden < Exception; end;
6
- class BadRequest < Exception; end;
7
- class NotFound < Exception; end;
3
+ class Base < Exception
4
+ alias_method :exception_body, :message
5
+ def attributes
6
+ @attributes ||= Paysio::JSON.decode(exception_body)['error']
7
+ end
8
+
9
+ def type
10
+ attributes['type']
11
+ end
12
+
13
+ def message
14
+ attributes['message']
15
+ rescue
16
+ exception_body
17
+ end
18
+
19
+ def params
20
+ attributes['params']
21
+ end
22
+ end
23
+ class Unauthorized < Base; end;
24
+ class InternalError < Base; end;
25
+ class Forbidden < Base; end;
26
+ class BadRequest < Base; end;
27
+ class NotFound < Base; end;
8
28
  end
9
29
  end
data/lib/paysio/json.rb CHANGED
@@ -6,7 +6,7 @@ module Paysio
6
6
  end
7
7
 
8
8
  def encode(json)
9
- Oj.dump(json, mode: :compat)
9
+ Oj.dump(json, :mode => :compat)
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Paysio
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paysio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-02 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client