class ErrorBot

Constants

GEM_ROOT
YAML_PATH

Public Class Methods

to_api(key, message=nil) click to toggle source
# 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

Private Class Methods

yaml_hash() click to toggle source
# File lib/error_bot.rb, line 17
def self.yaml_hash
  @hash ||= YAML.load_file(File.join(GEM_ROOT, YAML_PATH))
end