finix 0.12 → 0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmY5ODAxNGZiNTk3N2M0NGM2ZWIzMjk5NzdiMTg5NDhjNTI0MDE2NA==
4
+ ODNmZGZiNzc0NGE2NWI5NTlmMzUyZDA4NWIxZmFjZjdmM2Q2ODFmZg==
5
5
  data.tar.gz: !binary |-
6
- NTMyNmFlZGMwZGMwOTYzY2E3YTM1MjQ3NzI0ODc1NTRlODQxZWI4Nw==
6
+ MGVjZWQ5NDgwNTBhZmFlNGJjODZiZjZhM2M4YTBiYmY3ODk3NDI3NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODg5NmZhMDc2NjJhZWI5OTBlZmIwMDY5MWM2ZmJjOWJkMWNkNzhjMzU4NWU4
10
- YzU0Y2ExNTBkZDE3YWViYzgzMGQ1M2ZjZDMwOWVmY2M0YjcwMmM1MGZmYmNh
11
- NjA3ZDE1YzhmYTVlZjY1ODRjNDRiNjk0MjNkMDk4MDlhMzg3YWE=
9
+ NDQ3MzBjOTQ0ZDg5OTRlZGIxYmJjYWY0OWMzYmM3MmU4NjZkYzJkZWU2MDIz
10
+ OTNhNWZlOTg2MzkyZTA4OWZjNDhiZTk4ZGEzMzEzN2RjMGM0MzAzZGM2Zjhi
11
+ MGU4YjRmMWQwYzE3ZDhhMWIxZmE5ZTU1ZjkwYzBkMGQ2MTRlYjU=
12
12
  data.tar.gz: !binary |-
13
- ZGU3MDhmMDgxODJkYjgyOGM0NjJjZTJiZDI3ZjYzNjYzZjY3MWNiYjQxZTg4
14
- M2VkMThiYTk3ZTZlOTI5NjkzYmY4NDJjYWExZTAxODVlMjZhZTZjYjAxNTlk
15
- NTE3M2UzNmI0ZjZlNWMyNzVkMWNhMWRiNDk2ODZmYmIzZDZmOTE=
13
+ YjFkOGQ5M2E3NzMxYjg1ZDg4NjZjYmJhNmJmNjFjOWMzZTRmNGUxMWQyMjBk
14
+ NWI2ZWE3MDcyMThhYzVlNWMwM2UyY2FiZGJhZDdjODBkNjliZWQxNWFmMjkz
15
+ MGFjNjczYTI0ODVkYWU0OWU4ZGUzNzA2ZmRhNWY2ZjljYThhNTI=
data/lib/finix.rb CHANGED
@@ -11,11 +11,12 @@ module Finix
11
11
  :unknown => Finix::ResourceErrors,
12
12
  400 => Finix::BadRequest,
13
13
  401 => Finix::Unauthorized,
14
+ 402 => Finix::UpstreamProcessorError,
14
15
  403 => Finix::Forbidden,
15
16
  404 => Finix::NotFound,
16
17
  405 => Finix::MethodNotAllowed,
17
18
  422 => Finix::UnprocessableEntity,
18
- 500 => Finix::ServerError
19
+ 500 => Finix::InternalServerError
19
20
  }
20
21
 
21
22
  class << self
data/lib/finix/error.rb CHANGED
@@ -3,11 +3,15 @@ module Finix
3
3
  class ResourceErrors < ::StandardError
4
4
  attr_reader :response
5
5
  attr_reader :errors
6
+ attr_reader :code
6
7
 
7
8
  def initialize(response=nil)
8
9
  @response = response
9
10
  @errors = []
10
- @response[:body]['_embedded']['errors'].each { |error| @errors.push Finix::ResourceError.new error}
11
+ unless response.nil?
12
+ @code = response[:status].to_i
13
+ @response[:body]['_embedded']['errors'].each { |error| @errors.push Utils.eval_class(self, 'ResourceError').new error}
14
+ end
11
15
  end
12
16
 
13
17
  def to_s
@@ -34,9 +38,10 @@ module Finix
34
38
 
35
39
  class BadRequest < ResourceErrors; end
36
40
  class Unauthorized < ResourceErrors; end
41
+ class UpstreamProcessorError < ResourceErrors; end
37
42
  class Forbidden < ResourceErrors; end
38
43
  class NotFound < ResourceErrors; end
39
44
  class MethodNotAllowed < ResourceErrors; end
40
45
  class UnprocessableEntity < ResourceErrors; end
41
- class ServerError < ResourceErrors; end
46
+ class InternalServerError < ResourceErrors; end
42
47
  end
data/lib/finix/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Finix
2
- VERSION = '0.12'
2
+ VERSION = '0.13'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finix
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - finix-payments
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-10 00:00:00.000000000 Z
11
+ date: 2016-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday