error_response 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/error_response.rb +8 -1
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc3fa7849140a231dbc285ef371838efe21a45ec99ae156524a0f54bef763300
4
- data.tar.gz: e586365e16c38a5283dd20949d173262710cc1f04102b2e5a5da313a5ae524ff
3
+ metadata.gz: a5d432ebcabf92071c87523400f57e48da9a9f8661de3d3b8a876e4c4a3af55d
4
+ data.tar.gz: 7ec2778e10bfbbeb747a034b5a3cdb40fd380a7799d6cc96a688bbc628646c06
5
5
  SHA512:
6
- metadata.gz: 97c32d812b6815bae358426cec75d0e5f6bb8872e05e282de3bc43a3c0d0be6c38e72ce99cf1de4df5bd8177cd9a64cbf77db93817a93f7230d13dc9606d9a4b
7
- data.tar.gz: 553814f93c8bfdb03149f4eaf76c9fbe5b39307eab899941b56f5d840c6ae2044b9c08035ed0036dbc7d6d4f4b504cd5ed9d263cdd30732f8bc46e607d11c74b
6
+ metadata.gz: d77aa5697bd27a238f131d655e46ded35a6a57206e35697a30919151daa3586fed19cc247b9a713299af4a22aa087a06ab92d0ee77356ec6fb1a27f7a109e707
7
+ data.tar.gz: c6ce5a07d41871ee19f67cc31735a5537db8c8288f1c558bb1ede8f97290563962914a0fdd83253fa6ae202e2cd206851d589f8cf3c90228395d0ea0110adace
@@ -4,6 +4,7 @@ class ErrorResponse
4
4
 
5
5
  def self.to_api(key, message=nil)
6
6
  err_json = yaml_hash[key.to_s]&.dup
7
+ err_json['error_key'] = key.to_s if !err_json.nil? && !key.nil? && yaml_hash.key?(key.to_s)
7
8
  if err_json.nil?
8
9
  err_json = {'error_code' => 500000, 'error_message' => message}
9
10
  elsif !message.nil?
@@ -18,7 +19,13 @@ class ErrorResponse
18
19
  end
19
20
 
20
21
  def self.to_hash(key)
21
- yaml_hash[key.to_s] || {}
22
+ if yaml_hash.key?(key.to_s)
23
+ result = yaml_hash[key.to_s]
24
+ result['error_key'] = key.to_s
25
+ else
26
+ result = nil
27
+ end
28
+ result
22
29
  end
23
30
 
24
31
  def self.all
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: error_response
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jameslee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-08 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: use for error_response
14
14
  email: jameslee@kdanmobile.com
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
- rubygems_version: 3.0.6
39
+ rubygems_version: 3.0.3
40
40
  signing_key:
41
41
  specification_version: 4
42
42
  summary: A tool for API error response