class Object
Constants
- CONFIG_FILE
The config file
- EXE_NAME
The name of this program
Public Instance Methods
exit_json(error, detail)
click to toggle source
Rather than dump out a free-form string, on errors dump out something that the status board app can read in and display
@param error [String] Short description of the problem @param detail [String] Longer description or specific error code @return [nil]
# File bin/flareboard, line 15 def exit_json(error, detail) # return the error in json form sperror = { 'error' => { 'message' => error, 'detail' => detail } } STDERR.puts error, detail puts sperror.to_json exit 1 end
name_interval(interval)
click to toggle source
Take the integer that CloudFlare uses and return a description in english
@param interval [Integer] Integer needed by Cloudflare API @return [String] Description in english
# File bin/flareboard, line 32 def name_interval(interval) title = { 20 => 'Last Month', 30 => 'Last Week', 40 => 'Yesterday', 100 => '24 Hours Ago', 110 => '12 Hours Ago', 120 => '6 Hours Ago' } # hash.fetch will return the second parameter if the key doesn't exist title.fetch(interval, 'Invalid interval') end