Class: CheetahMail::Messenger
- Inherits:
-
Object
- Object
- CheetahMail::Messenger
- Defined in:
- lib/cheetah_mail/messenger/messenger.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#do_request(message) ⇒ Object
handles sending the request and processing any exceptions.
-
#initialize(options) ⇒ Messenger
constructor
A new instance of Messenger.
-
#send_message(message) ⇒ Object
determines if and how to send based on options returns true if the message was sent false if it was suppressed.
Constructor Details
#initialize(options) ⇒ Messenger
Returns a new instance of Messenger.
8 9 10 11 |
# File 'lib/cheetah_mail/messenger/messenger.rb', line 8 def initialize() @options = @cookie = nil end |
Instance Method Details
#do_request(message) ⇒ Object
handles sending the request and processing any exceptions
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cheetah_mail/messenger/messenger.rb', line 27 def do_request() begin login unless @cookie initheader = {'Cookie' => @cookie || ''} .params['aid'] = @options[:aid] resp = do_post(.path, .params, initheader) rescue CheetahMailAuthorizationException => e # it may be that the cookie is stale. clear it and immediately retry. # if it hits another authorization exception in the login function then it will come back as a permanent exception @cookie = nil retry end end |
#send_message(message) ⇒ Object
determines if and how to send based on options returns true if the message was sent false if it was suppressed
16 17 18 19 20 21 22 23 24 |
# File 'lib/cheetah_mail/messenger/messenger.rb', line 16 def () if !@options[:whitelist_filter] or .params['email'] =~ @options[:whitelist_filter] .params['test'] = "1" unless @options[:enable_tracking] do_send() # implemented by the subclass true else false end end |