Module: Mandrill::Rails::WebHookProcessor::ClassMethods

Defined in:
lib/mandrill-rails/web_hook_processor.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_with_mandrill_keys!(*keys) ⇒ Object

Gets/sets the current Mandrill WebHook Authentication key(s). Returns the current WebHook key(s) as an Array if called with no parameters. If called with parameters, add the params to the WebHook key array. If called with nil as the parameters, clears the WebHook key array.



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mandrill-rails/web_hook_processor.rb', line 46

def authenticate_with_mandrill_keys!(*keys)
  @mandrill_webhook_keys ||= []
  if keys.present?
    if keys.compact.present?
      @mandrill_webhook_keys.concat(keys.flatten)
    else
      @mandrill_webhook_keys = []
    end
  end
  @mandrill_webhook_keys
end

#ignore_unhandled_events!Object



74
75
76
# File 'lib/mandrill-rails/web_hook_processor.rb', line 74

def ignore_unhandled_events!
  on_unhandled_mandrill_events! :ignore
end

#mandrill_webhook_keysObject

Gets the current Mandrill WebHook Authentication key(s).



59
60
61
# File 'lib/mandrill-rails/web_hook_processor.rb', line 59

def mandrill_webhook_keys
  authenticate_with_mandrill_keys!
end

#mandrill_webhook_keys=(keys) ⇒ Object

Command: directly assigns the WebHook key array to keys.



64
65
66
# File 'lib/mandrill-rails/web_hook_processor.rb', line 64

def mandrill_webhook_keys=(keys)
  @mandrill_webhook_keys = Array(keys)
end

#on_unhandled_mandrill_events!(new_setting = nil) ⇒ Object



68
69
70
71
72
# File 'lib/mandrill-rails/web_hook_processor.rb', line 68

def on_unhandled_mandrill_events!(new_setting=nil)
  @on_unhandled_mandrill_events = new_setting unless new_setting.nil?
  @on_unhandled_mandrill_events ||= :log
  @on_unhandled_mandrill_events
end

#unhandled_events_raise_exceptions!Object



78
79
80
# File 'lib/mandrill-rails/web_hook_processor.rb', line 78

def unhandled_events_raise_exceptions!
  on_unhandled_mandrill_events! :raise_exception
end