error_response 0.1.2 → 0.1.3
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 +11 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb1fff56885d056e0ff23ba2da10daa85875a60c3c6afb97a840ac601f23f138
|
4
|
+
data.tar.gz: 28342938f10616bfba217b042b58156f83c82831f524717a446edeb17ce8d032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d32e77ff063489bce54f894b158b18a53b7d211ee7cf92a8f3aa47b9425f6baafc30b9cfc6238f5d25109bc49f8fe392b3363d6bde1be34607eee9b08bf85db
|
7
|
+
data.tar.gz: 0ca3cfd25e3073fadd087587007c00a548b8ea9ad225ba6eace37ecaf326f57048a788c5e869a8013ba86125d3b775cfe1ce2046ad3a6651f0d4fe65af60898c
|
data/lib/error_response.rb
CHANGED
@@ -4,8 +4,7 @@ class ErrorResponse
|
|
4
4
|
YAML_PATH = 'lib/error_response.yml'
|
5
5
|
|
6
6
|
def self.to_api(key, message=nil)
|
7
|
-
|
8
|
-
err_json = string_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
|
7
|
+
err_json = yaml_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
|
9
8
|
|
10
9
|
status = err_json['error_code'] / 1000
|
11
10
|
{
|
@@ -15,7 +14,15 @@ class ErrorResponse
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.to_hash(key)
|
18
|
-
|
19
|
-
|
17
|
+
yaml_hash[key.to_s]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.all
|
21
|
+
yaml_hash
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def self.yaml_hash
|
26
|
+
yaml ||= YAML.load_file(File.join(GEM_ROOT,YAML_PATH))
|
20
27
|
end
|
21
28
|
end
|