error_bot 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/error_bot.rb +19 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 251aa1a55182c8b3b31f389671782cc485b4687c2818733f31e12fe10d508208
4
+ data.tar.gz: 0ad4fce0865f120426ef3d5c125169c79a7ea839e32da0750482c35ce09d6297
5
+ SHA512:
6
+ metadata.gz: 57d2a227a85af0be4d1b9f1cbfd12f045756bff6b278f802386b3f666aca20e2b818c74c3e3f2bd2103d83a024fee1433a1b87f8e666bb1abf695411acd6ad2e
7
+ data.tar.gz: 637104ac7cc94be4b47dccc24a7ec73bf82578c0d964b16ae3859f06a6756fed2fa73130fac993224d8a87a724e4df28ecf3f394182fce059087c3ca5788f726
data/lib/error_bot.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'yaml'
2
+ class ErrorBot
3
+ YAML_PATH = "./lib/error_code.yml"
4
+
5
+ def self.to_api(key, message=nil)
6
+ err_json = yaml_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}
7
+
8
+ status = err_json['error_code'] / 1000
9
+ {
10
+ 'status' => status,
11
+ 'json' => err_json
12
+ }
13
+ end
14
+
15
+ private
16
+ def self.yaml_hash
17
+ @hash ||= YAML.load_file(YAML_PATH)
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: error_bot
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-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Nothing but a tutorial
14
+ email: jameslee@kdanmobile.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/error_bot.rb
20
+ homepage: https://rubygems.org/gems/error_bot
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: '0'
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: For tutorial
43
+ test_files: []