Class: Undantag::Notifier
- Inherits:
-
Object
- Object
- Undantag::Notifier
- Defined in:
- lib/undantag/notifier.rb
Constant Summary collapse
- URL =
"https://undantag.herokuapp.com/exception"
Class Method Summary collapse
Class Method Details
.notify(request, exception) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/undantag/notifier.rb', line 4 def self.notify request, exception unless Undantag::Configuration.api_key raise Undantag::ConfigurationError::NoApiKey end uri = URI(Notifier::URL) key = Undantag::Configuration.api_key post_params = Undantag::Configuration.to_hash.merge(env: ENV, request: request, exception: exception) resp = Net::HTTP.post_form(uri, post_params) case resp.code when "401" raise Undantag::NotAuthorized end end |