error_response 0.1.0 → 0.1.2
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 +6 -1
- 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: 9399ce1f1928133803e46493fdd9a83e89b4c91002ec1168173081f5ecc5a9d7
|
4
|
+
data.tar.gz: 9255d7dc8f8d9274dabd4e4d274d0d99900edbd66723f7335ed5eaf20f97e379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a70f5c87344a5fc8561eaa00807b4eb9dd50f5766dba600457991241b52e0490b7fd0f180c9af96d4fa0e27871fa4a4c78a8e5c8c0a9bf12f8c24ffa2489f629
|
7
|
+
data.tar.gz: dcfa05015e5da084ad0aab70ce9c90af354a54d8cc602f515c622ca68de290c453565537b591968ba9923063606a4bd6731d637c7e8912af19dd3ee7a24eb71e
|
data/lib/error_response.rb
CHANGED
@@ -3,7 +3,7 @@ class ErrorResponse
|
|
3
3
|
GEM_ROOT = File.expand_path("../..", __FILE__)
|
4
4
|
YAML_PATH = 'lib/error_response.yml'
|
5
5
|
|
6
|
-
def self.
|
6
|
+
def self.to_api(key, message=nil)
|
7
7
|
string_hash = YAML.load_file(File.join(GEM_ROOT,YAML_PATH))
|
8
8
|
err_json = string_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
|
9
9
|
|
@@ -13,4 +13,9 @@ class ErrorResponse
|
|
13
13
|
'json' => err_json
|
14
14
|
}
|
15
15
|
end
|
16
|
+
|
17
|
+
def self.to_hash(key)
|
18
|
+
string_hash = YAML.load_file(File.join(GEM_ROOT,YAML_PATH))
|
19
|
+
string_hash[key.to_s]
|
20
|
+
end
|
16
21
|
end
|