Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Hominid to Mailchimp #177

Merged
merged 3 commits into from Aug 31, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+20 −17
Diff settings

Always

Just for now

Copy path View file
@@ -6,7 +6,7 @@ gem 'json', '~> 1.7.7'
gem 'multi_xml', '>= 0.5.2'

gem 'pg', '0.16.0'
gem 'hominid'
gem 'mailchimp'
gem 'omniauth-oauth2', '~> 1.1.1'
gem 'omniauth-github', '~> 1.0.1'

Copy path View file
@@ -108,7 +108,6 @@ GEM
hashie (1.2.0)
highline (1.6.15)
hike (1.2.1)
hominid (3.0.2)
httparty (0.10.2)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
@@ -128,6 +127,8 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mailchimp (0.0.9)
httparty
mailhopper (0.0.9)
rails (>= 3.1.0)
md_emoji (0.0.8)
@@ -295,11 +296,11 @@ DEPENDENCIES
factory_girl_rails
god
haml
hominid
httparty (>= 0.10.0)
jquery-rails
json (~> 1.7.7)
launchy
mailchimp
mailhopper (~> 0.0.4)
md_emoji
md_preview
Copy path View file
@@ -2,18 +2,21 @@ class UserManager
attr_reader :client, :list_id

def initialize
@client = Hominid::API.new(MailChimp::SETTINGS[:api_key])
@list_id = MailChimp::SETTINGS[:list_id]
@client = Mailchimp::API.new(MailChimpSettings[:api_key])
@client.throws_exceptions = true
@list_id = MailChimpSettings[:list_id]
end

def delete_user(email)
client.list_unsubscribe(list_id, email, true)
client.list_unsubscribe(:id => list_id,
:email_address => email,
:delete_member => true)

AccountMailer.unsubscribed(email)
end

def unsubscribed_users
client.list_members(list_id, "unsubscribed")["data"].map {|u| u["email"] }
client.list_members(:id => list_id, :status => "unsubscribed")["data"].map {|u| u["email"] }
end

def disable_unsubscribed_users
@@ -29,4 +32,4 @@ def disable_unsubscribed_users
delete_user(email)
end
end
end
end
@@ -1,8 +1,7 @@
module MailChimp
SETTINGS = { :list_id => 'YOUR-LIST-ID',
:api_key => 'YOUR-API-KEY',
:testers => ["your@email.com"],
:sender_name => "Your Sender Name",
:sender_email => "Your Sender Email",
:webhook_key => "Your webhook key" }
end
MailChimpSettings = {
:list_id => 'YOUR-LIST-ID',
:api_key => 'YOUR-API-KEY',
:testers => ["your@email.com"],
:sender_name => "Your Sender Name",
:sender_email => "Your Sender Email",
:webhook_key => "Your webhook key" }
Copy path View file
@@ -3,7 +3,7 @@

mount StripeEvent::Engine => STRIPE_WEBHOOK_PATH

match "/hooks/#{MailChimp::SETTINGS[:webhook_key]}" => 'hooks#receive'
match "/hooks/#{MailChimpSettings[:webhook_key]}" => 'hooks#receive'
match '/articles/shared/:secret' => 'articles#shared', :as => "shared_article"
match '/subscribe' => 'home#subscribe', :as => 'subscribe'

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.