Module: Merb::HoptoadNotifier
- Defined in:
- lib/merb_hoptoad_notifier/hoptoad_notifier.rb
Constant Summary collapse
- VERSION =
'1.1.1'
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.environment_filters ⇒ Object
Returns the value of attribute environment_filters.
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 5 def api_key @api_key end |
.environment_filters ⇒ Object
Returns the value of attribute environment_filters.
5 6 7 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 5 def environment_filters @environment_filters end |
.logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 5 def logger @logger end |
Class Method Details
.configure ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 8 def self.configure key = YAML.load_file(Merb.root / 'config' / 'hoptoad.yml') if key env = key[Merb.env.to_sym] env ? @api_key = env[:api_key] : raise(ArgumentError, "No hoptoad key for Merb environment #{Merb.env}") end end |
.dispatcher ⇒ Object
48 49 50 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 48 def self.dispatcher @dispatcher ||= ToadHopper.new(api_key) end |
.notify_hoptoad(request, session) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/merb_hoptoad_notifier/hoptoad_notifier.rb', line 29 def self.notify_hoptoad(request, session) request.exceptions.each do |exception| = { :api_key => HoptoadNotifier.api_key, :url => "#{request.protocol}://#{request.host}#{request.path}", :component => request.params['controller'], :action => request.params['action'], :request => request, :framework_env => Merb.env, :notifier_name => 'Merb::HoptoadNotifier', :notifier_version => Merb::HoptoadNotifier::VERSION, :session => session.to_hash } dispatcher.filters = environment_filters.flatten dispatcher.post!(exception, , {'X-Hoptoad-Client-Name' => 'Merb::HoptoadNotifier'}) end true end |