whatcounts
DESCRIPTION:
Ruby library with Rails Mailer class for working with WhatCounts mail provider.
1) Make sure to configure WhatCounts:
WhatCounts::HttpClient.configure do
realm "my_realm"
password "foobar"
end
Then to use (better usages soon):
Lists
WhatCounts::List.create! { :name => 'name', :template_id => 'template',
:from_address => '', :reply_to_address => '', :bounce_address => '',
:track_clicks => true, :track_opens => true }
One Off Messages
WhatCounts::OneOffMessage.new :list_id => 1234, :template_id => 5678, :to => '[email protected]', :format => 99
WhatCounts::OneOffMessage.send! :list_id => 1234, :template_id => 5678, :format => 99,
:to => "[email protected]", :from => "[email protected]",
:subject => headline,
:data => { :url => "http://example.com",
:some_number => 1234
}
Rails Integration (place in environments/#{RAILS_ENV}.rb)
config.after_initialize do
module ::WhatCounts
Rails::Mailer.default_url_options = {:host => 'assets.example.com'} # needed for url_for to work
HttpClient.configure do
realm "my_realm"
password "foobar"
end
end
end
Then extend the WhatCounts::Rails::Mailer class and use similar to ActionMailer::Base
class SomeMailer < WhatCounts::Rails::Mailer
# I will be adding method_missing logic so you can call the mailer like you would in Rails.
class << self
def deliver_something(*args)
self.new.something(*args)
end
end
def something(*args)
# do yer mailing
end
end
It's still largely incomplete as it was designed to serve specific needs. Feel free to contribute.
FEATURES/PROBLEMS:
SYNOPSIS:
REQUIREMENTS:
-
curb
-
fastercsv
INSTALL:
gem install ihunter-whatcounts
LICENSE:
(The MIT License)
Copyright © 2009 cocodot
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.