error_response 0.0.1

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 +7 -0
  2. data/lib/error_response.rb +19 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7e6b6053f2f81ba2ebe8af1fcba5f12d271b8eb916c2d0d957f67a4b8e58ff2a
4
+ data.tar.gz: d120b5bed3afa1260036c8fdefc058c9fea94c860cdc75273d6d1a7b851a3110
5
+ SHA512:
6
+ metadata.gz: 7e98936b29e454ff996d35e734d453a507e970360284169036cd0ef278a49b500d2f6e89d74919c4085088b15ff3a6f24cb7e104bab3afb605cc97bac92269a9
7
+ data.tar.gz: 1176cb47103a7596f4055c59970d61de33b3a2f5cdef916c634843924ecc5c27b072a18ace0a0b442d4ced12de6d63c3e88e9544abb2e8aad5ba48b7821d4418
@@ -0,0 +1,19 @@
1
+ require 'settingslogic'
2
+ class ErrorResponse < Settingslogic
3
+ source "lib/error_code.yml"
4
+
5
+ def api_format(key)
6
+ error_data = send(key)
7
+ status = fetch_status(error_data['error_code'])
8
+ {
9
+ status: status,
10
+ json: error_data
11
+ }
12
+ end
13
+
14
+ private
15
+ def fetch_status(error_code)
16
+ return error_code if error_code == 500
17
+ error_code[0..2]
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: error_response
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - jameslee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: use for error_response
14
+ email: jameslee@kdanmobile.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/error_response.rb
20
+ homepage: https://github.com/kdan-mobile-software-ltd/error_respons
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.5.1
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.4
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: A tool for API error response
43
+ test_files: []