Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e8a814d
Showing
7 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source :rubygems | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Manifest | ||
README.rdoc | ||
Rakefile | ||
lib/mailchimp_subscriber.rb |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
require 'echoe' | ||
|
||
Echoe.new('mailchimp_subscriber', '0.1.0') do |p| | ||
p.description = "Sync user emails with MailChimp mailing lists" | ||
p.url = "http://github.com/bbwharris/mailchimp_subscriber" | ||
p.email = "brandon@brandon-harris.com" | ||
p.ignore_pattern = ["tmp/*", "script/*"] | ||
p.development_dependencies = [['hominid','>= 3.0.2']] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module MailchimpSubscriber | ||
require 'hominid' | ||
|
||
def subscribe_to(listname,options={}) | ||
after_create do |record| | ||
begin | ||
email = record.send(options[:using][:email]) | ||
content_type = options[:using][:content_type] || 'html' | ||
update_existing = options[:using][:update_existing] || false | ||
replace_interests = options[:using][:replace_interests] || false | ||
send_welcome = options[:using][:send_welcome] || false | ||
|
||
client = Hominid::API.new(mailchimp_api_key) | ||
list_id = h.find_list_by_name(listname)['id'] | ||
client.list_subscribe(list_id, email, {}, type, double_optin, update_existing, replace_interests, send_welcome) | ||
rescue RuntimeError | ||
end | ||
end | ||
|
||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "mailchimp_subscriber" | ||
s.version = '0.1.0' | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ["Brandon Harris"] | ||
s.email = ["brandon@brandon-harris.com"] | ||
s.homepage = "https://github.com/bbwharris/mailchimp_subscriber" | ||
s.summary = %q{Sync user emails with MailChimp mailing lists} | ||
s.description = %q{Sync user emails with MailChimp mailing lists} | ||
|
||
s.files = `git ls-files -- {lib/*,vendor/*,*.gemspec}`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_development_dependency 'rails', '>= 3.0.0' | ||
s.add_development_dependency 'hominid', '>= 3.2.0' | ||
|
||
ruby_minor_version = RUBY_VERSION.split('.')[1].to_i | ||
end |