error_response 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/error_response.rb +10 -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: bfd7efb20d85b835e242e64e7fee3d633522eefbe1834aedf30295b84b2cfea8
|
4
|
+
data.tar.gz: 9e9013875242b545811ce64585d3cf8f58a33775d773b507125e7cd8934bbaca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3d15d0cd86e5fea18fba693fef5b75fae6b8ba409a73b4d377cfa85e45e70d4cf87b116c6c3e78238cb16c047b8da10943b09abe33ece451a24aa83b462deb
|
7
|
+
data.tar.gz: 0aafe71739e97cd17b3fadb3614cf7c3e9fc6a221d77bab5a6bc4960d6e2374c3f9f881756153d333e59078049560268df4e290891d1ba1e4a9276bc263f1df1
|
data/lib/error_response.rb
CHANGED
@@ -2,6 +2,7 @@ require 'yaml'
|
|
2
2
|
class ErrorResponse
|
3
3
|
GEM_ROOT = File.expand_path("../..", __FILE__)
|
4
4
|
YAML_PATH = 'lib/error_response.yml'
|
5
|
+
EXTEND_DIR = 'lib/error_response/*.yml'
|
5
6
|
|
6
7
|
def self.to_api(key, message=nil)
|
7
8
|
err_json = yaml_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
|
@@ -23,6 +24,14 @@ class ErrorResponse
|
|
23
24
|
|
24
25
|
private
|
25
26
|
def self.yaml_hash
|
26
|
-
|
27
|
+
return @hash unless @hash.nil?
|
28
|
+
|
29
|
+
@hash = YAML.load_file(File.join(GEM_ROOT,YAML_PATH))
|
30
|
+
Dir.glob(EXTEND_DIR).each do |file|
|
31
|
+
extend_yml = YAML.load_file(file)
|
32
|
+
@hash.merge!(extend_yml)
|
33
|
+
end
|
34
|
+
|
35
|
+
@hash
|
27
36
|
end
|
28
37
|
end
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jameslee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: use for error_response
|
14
14
|
email: jameslee@kdanmobile.com
|