module SoarSc::Web::Views::Default
Public Class Methods
error(ex)
click to toggle source
# File lib/soar_sc_views/default.rb, line 29 def self.error(ex) if ex.is_a?(Exception) body = "#{ex.class}: #{ex.message}" body = body + ":\n\t" + ex.backtrace.join("\n\t") if ENV['RACK_ENV'] == 'development' else body = ex.to_s end [500, {"Content-Type" => "text/html"}, [body]] end
not_authenticated()
click to toggle source
# File lib/soar_sc_views/default.rb, line 17 def self.not_authenticated [401, {}, ["401 - Not authenticated"]] end
not_found()
click to toggle source
# File lib/soar_sc_views/default.rb, line 13 def self.not_found [404, {}, ["404 - Not found"]] end
not_valid(errors)
click to toggle source
# File lib/soar_sc_views/default.rb, line 25 def self.not_valid(errors) [400, {"Content-Type" => "application/json"} , errors] end
render(http_code, body)
click to toggle source
# File lib/soar_sc_views/default.rb, line 9 def self.render(http_code, body) [http_code, {"Content-Type" => "text/html"}, [body]] end