class NotFoundNotifier
Public Class Methods
crawler?(user_agent)
click to toggle source
# File lib/nexmo_developer/app/services/not_found_notifier.rb, line 23 def self.crawler?(user_agent) Woothee.parse(user_agent)[:category] == :crawler end
ignored_format?(format)
click to toggle source
# File lib/nexmo_developer/app/services/not_found_notifier.rb, line 17 def self.ignored_format?(format) return false unless format IGNORED_FORMATS.include? format.downcase end
notification_name(exception)
click to toggle source
# File lib/nexmo_developer/app/services/not_found_notifier.rb, line 27 def self.notification_name(exception) if exception.instance_of? Nexmo::Markdown::DocFinder::MissingDoc 'Missing Document' else '404 - Not Found' end end
notify(request, exception)
click to toggle source
# File lib/nexmo_developer/app/services/not_found_notifier.rb, line 4 def self.notify(request, exception) return if ignored_format?(request.params['format']) return if crawler?(request.user_agent) Bugsnag.notify(notification_name(exception)) do |notification| notification.add_tab(:request, { params: request.params, path: request.path, base_url: request.base_url, }) end end