payfort_start 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/start/base_resource.rb +6 -16
- data/lib/start/errors/start_error.rb +3 -4
- data/lib/start/version.rb +1 -1
- data/spec/lib/start/error/banking_error_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b0bfdca559a9ca3276432bdf7cde6a479fa080
|
4
|
+
data.tar.gz: fdb8087d4461755e61a7ab0313ef6075dea73ba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bcdb5efc99c2aedd93028aabc690247658340c957f45cc4d19e45a9c2e8dd9eeb7082de92c1f1fefd6d8eee7f8176676b352c509b0aa49d93ca1cf92ac9803a
|
7
|
+
data.tar.gz: b00f6da8ca8a47450c562f6ca717335d82ce1e59351a3b274b5e7c90e2e3c609e980b39ebebbabd8dab89afa42e260c478ca4d9b43ee8aee2ff3e57bdfbdeaf4
|
data/Gemfile.lock
CHANGED
data/lib/start/base_resource.rb
CHANGED
@@ -25,23 +25,13 @@ module Start
|
|
25
25
|
return body
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
exception_class = if ['banking', 'authentication', 'processing', 'request'].include?(body['error']['type'])
|
29
|
+
Object.const_get "Start::#{body['error']['type'].capitalize}Error"
|
30
|
+
else
|
31
|
+
StartError
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
raise Start::AuthenticationError.new(body['error']['message'], body['error']['code'], response.code)
|
35
|
-
|
36
|
-
when 'processing'
|
37
|
-
raise Start::ProcessingError.new(body['error']['message'], body['error']['code'], response.code)
|
38
|
-
|
39
|
-
when 'request'
|
40
|
-
raise Start::RequestError.new(body['error']['message'], body['error']['code'], response.code)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Otherwise, raise a General error
|
44
|
-
raise Start::StartError.new(body['error']['message'], body['error']['code'], response.code)
|
34
|
+
raise exception_class.new(body['error']['message'], body['error']['code'], response.code, body['error']['extras'])
|
45
35
|
end
|
46
36
|
end
|
47
37
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module Start
|
2
2
|
class StartError < StandardError
|
3
|
-
attr_reader :message
|
4
|
-
attr_reader :code
|
5
|
-
attr_reader :http_status
|
3
|
+
attr_reader :message, :code, :http_status, :extras
|
6
4
|
|
7
|
-
def initialize(message=nil, code=nil, http_status=nil)
|
5
|
+
def initialize(message = nil, code = nil, http_status = nil, extras = {})
|
8
6
|
@message = message
|
9
7
|
@code = code
|
10
8
|
@http_status = http_status
|
9
|
+
@extras = extras
|
11
10
|
end
|
12
11
|
|
13
12
|
def to_s
|
data/lib/start/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payfort_start
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Gabriel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08
|
12
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|