ghtk 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ghtk/error.rb +7 -6
- data/lib/ghtk/order.rb +1 -1
- data/lib/ghtk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dff685accc07bacdf2bb1c08e5df3d7efc9b3ac9e1a27f33ce5d53f7c54c9fd8
|
4
|
+
data.tar.gz: 1cf9cfa5e2f0c4c61de79c2c8a1ffdb367e9353326b67e33adcc7eb55a3bef72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad10824bdaa792206024e76c8cd8a4d67b79e1998e418d1812bfefbbdf4086ba75bfbb10f5f30882dbbabb52b1652843f87c70d0d7d156c2149492e88ebc957
|
7
|
+
data.tar.gz: cfd44d8ae1de7bed387858066ba5656b5c9609ffb8f166e3f2803f6fb7ebd6882e87986cb78559cfaa8c55da025c2001f4bad6136a3893e9d14563eeb7d8de8c
|
data/lib/ghtk/error.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
module Ghtk
|
2
|
-
class Error < StandardError; end
|
3
|
-
class ForbiddenError < Error; end
|
4
|
-
class ServerError < Error; end
|
5
|
-
class CreateOrderError < Error; end
|
6
|
-
class BadParamsError < Error; end
|
7
2
|
|
8
|
-
class RequestError <
|
3
|
+
class RequestError < StandardError
|
9
4
|
|
10
5
|
attr_reader :response
|
11
6
|
|
@@ -16,6 +11,12 @@ module Ghtk
|
|
16
11
|
|
17
12
|
end
|
18
13
|
|
14
|
+
class Error < StandardError; end
|
15
|
+
class ForbiddenError < Error; end
|
16
|
+
class ServerError < Error; end
|
17
|
+
class CreateOrderError < Error; end
|
18
|
+
class BadParamsError < Error; end
|
19
|
+
|
19
20
|
class OrderIdExistError < RequestError; end
|
20
21
|
|
21
22
|
end
|
data/lib/ghtk/order.rb
CHANGED
@@ -6,7 +6,7 @@ module Ghtk
|
|
6
6
|
Ghtk::Validations::OrderValidation.new(create_data).validate!
|
7
7
|
Ghtk::Request.post('/services/shipment/order', create_data)
|
8
8
|
rescue Ghtk::RequestError => e
|
9
|
-
error_code = e.response.dig('error', 'code')
|
9
|
+
error_code = e.response.dig('error', 'code') || 'REQUEST'
|
10
10
|
error_class = "Ghtk::#{error_code.downcase.classify}Error".safe_constantize || Ghtk::RequestError
|
11
11
|
raise error_class, e.response
|
12
12
|
rescue Ghtk::ForbiddenError
|
data/lib/ghtk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghtk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KhoaRB
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|