Class: ErrorBot

Inherits:
Object
  • Object
show all
Defined in:
lib/error_bot.rb

Constant Summary collapse

GEM_ROOT =
File.expand_path("../..", __FILE__)
YAML_PATH =
"./lib/error_code.yml"

Class Method Summary collapse

Class Method Details

.to_api(key, message = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/error_bot.rb', line 6

def self.to_api(key, message=nil)
  err_json = yaml_hash[key.to_s] || {'error_code' => 500000, 'error_message' => message}

  status = err_json['error_code'] / 1000
  {
    'status' => status,
    'json' => err_json
  }
end