Module: SoarSc::Web::Views::Default
- Includes:
- Jsender
- Defined in:
- lib/soar_sc_views/default.rb
Class Method Summary collapse
- .error(ex) ⇒ Object
- .not_authenticated ⇒ Object
- .not_authorized ⇒ Object
- .not_found ⇒ Object
- .not_valid(errors) ⇒ Object
- .render(http_code, body) ⇒ Object
Class Method Details
.error(ex) ⇒ Object
29 30 31 32 |
# File 'lib/soar_sc_views/default.rb', line 29 def self.error(ex) body = ex.is_a?(Exception) ? ex. : ex.to_s [500, {"Content-Type" => "text/html"}, [body]] end |
.not_authenticated ⇒ Object
17 18 19 |
# File 'lib/soar_sc_views/default.rb', line 17 def self.not_authenticated [401, {}, ["401 - Not authenticated"]] end |
.not_authorized ⇒ Object
21 22 23 |
# File 'lib/soar_sc_views/default.rb', line 21 def self. [403, {}, [" 403 - Not authorized"]] end |
.not_found ⇒ Object
13 14 15 |
# File 'lib/soar_sc_views/default.rb', line 13 def self.not_found [404, {}, ["404 - Not found"]] end |
.not_valid(errors) ⇒ Object
25 26 27 |
# 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) ⇒ Object
9 10 11 |
# File 'lib/soar_sc_views/default.rb', line 9 def self.render(http_code, body) [http_code, {"Content-Type" => "text/html"}, [body]] end |