Class: MerbExceptions::Notification
- Inherits:
-
Object
- Object
- MerbExceptions::Notification
- Defined in:
- merb-exceptions/lib/merb-exceptions/notification.rb
Defined Under Namespace
Classes: Mailer
Instance Attribute Summary (collapse)
-
- (Object) details
readonly
Returns the value of attribute details.
Instance Method Summary (collapse)
- - (Object) deliver!
- - (Object) deliver_emails!
- - (Object) deliver_web_hooks!
- - (Object) email_addresses
- - (Object) environments
-
- (Notification) initialize(details = nil)
constructor
A new instance of Notification.
- - (Object) params
- - (Object) web_hooks
Constructor Details
- (Notification) initialize(details = nil)
A new instance of Notification
14 15 16 17 18 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 14 def initialize(details = nil) @details = details || [] Mailer.config = Merb::Plugins.config[:exceptions][:mailer_config] Mailer.delivery_method = Merb::Plugins.config[:exceptions][:mailer_delivery_method] end |
Instance Attribute Details
- (Object) details (readonly)
Returns the value of attribute details
12 13 14 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 12 def details @details end |
Instance Method Details
- (Object) deliver!
20 21 22 23 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 20 def deliver! deliver_web_hooks! deliver_emails! end |
- (Object) deliver_emails!
32 33 34 35 36 37 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 32 def deliver_emails! Merb.logger.info "DELIVERING EXCEPTION EMAILS" email_addresses.each do |address| send_email(address) end end |
- (Object) deliver_web_hooks!
25 26 27 28 29 30 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 25 def deliver_web_hooks! Merb.logger.info "DELIVERING EXCEPTION WEB HOOKS" web_hooks.each do |address| post_hook(address) end end |
- (Object) email_addresses
41 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 41 def email_addresses; option_as_array(:email_addresses); end |
- (Object) environments
43 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 43 def environments; option_as_array(:environments); end |
- (Object) params
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 45 def params @params ||= { 'request_url' => details['url'], 'request_controller' => details['params'][:controller], 'request_action' => details['params'][:action], 'request_params' => details['params'], 'environment' => details['environment'], 'exceptions' => details['exceptions'], 'app_name' => Merb::Plugins.config[:exceptions][:app_name] } end |
- (Object) web_hooks
39 |
# File 'merb-exceptions/lib/merb-exceptions/notification.rb', line 39 def web_hooks; option_as_array(:web_hooks); end |