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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: befe2b34fb39b7a77c38e62d0c64e16660393a216dac6bcd843b891d4683c9f0
4
- data.tar.gz: c5688bfc1b40c2cdf7c449a84c51bad9c91b250f4c824eb8b6b1d21dd3ffbe77
3
+ metadata.gz: dff685accc07bacdf2bb1c08e5df3d7efc9b3ac9e1a27f33ce5d53f7c54c9fd8
4
+ data.tar.gz: 1cf9cfa5e2f0c4c61de79c2c8a1ffdb367e9353326b67e33adcc7eb55a3bef72
5
5
  SHA512:
6
- metadata.gz: 8e61403724fd09d14614b6201265551c2cb34a0894b2acf654654a17fb558e0930cbe019f7e10acdcb85738a69c8e056751a37e1aa979e2561e37354053e3b67
7
- data.tar.gz: bc70a179e8c7249f8c59b437b8a1cbab8e9bf28cef08a4ea9779fe664318dc357affa1ab41fb95082d8ace1fda671abf8c8c7336e40e78fcf6b8e75a0ff20a96
6
+ metadata.gz: cad10824bdaa792206024e76c8cd8a4d67b79e1998e418d1812bfefbbdf4086ba75bfbb10f5f30882dbbabb52b1652843f87c70d0d7d156c2149492e88ebc957
7
+ data.tar.gz: cfd44d8ae1de7bed387858066ba5656b5c9609ffb8f166e3f2803f6fb7ebd6882e87986cb78559cfaa8c55da025c2001f4bad6136a3893e9d14563eeb7d8de8c
@@ -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 < Error
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Ghtk
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
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.2
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-22 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http