CatarseMailchimp
Catarse mailchimp integration with Catarse crowdfunding platform
Instalation
Add this lines to your Catarse application's Gemfile:
gem 'catarse_mailchimp', git: 'git://github.com/catarse/catarse_mailchimp.git', branch: 'master'
And then execute:
$ bundle
Usage
Add on user model app/models/user.br
class User < ActiveRecord::Base
...
sync_with_mailchimp subscribe_data: ->(user) { { EMAIL: user.email, NAME: user.name } },
list_id: 'listID',
subscribe_when: ->(user) { user.newsletter_changed? && user.newsletter },
unsubscribe_when: ->(user) { user.newsletter_changed? && !user.newsletter },
ubsubscribe_email: ->(user) { user.email }
...
end
Configurations
Create this configurations into Catarse database:
mailchimp_api_key, mailchimp_list_id
In Rails console, run this:
Configuration.create!(name: "mailchimp_api_key", value: "API_KEY")
Configuration.create!(name: "mailchimp_list_id", value: "LIST_ID")
Create a mailchimp configuration file on config/initilazers/mailchimp.rb and add:
MAILCHIMP_API_KEY = Configuration[:mailchimp_api_key]
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
This project rocks and uses MIT-LICENSE.