GithubHelp home page GithubHelp logo

chimpactions's Introduction

Chimpactions

Easily move contacts between MailChimp lists in your Rails 3 application.

Requirements

A MailChimp account and API key.

Installation

Base

  1. Gemfilegem "chimpactions", "~> 0.0.1"
  2. rails generate chimpactions:install
  3. Edit config/chimpactions.yml with your information.
  4. add include Chimpactions::Subscriber to your model.
  5. add after_save :chimpactions (if that’s what you want) to your model.

The YourModel.chimpactions method fires the actions to move subscribers as specified.

Generates:

  • config/chimpactions.yml config file

ActiveRecord store

rails generate chimpactions:migration

rake db:migrate

Generates:

  • chimpactions ActiveRecord migration

Customizing Admin

Chimpactions provides a basic scaffold for managing ActiveRecord Actions @ http:yourapp/chimpactions.
To override the gem views :

rails generate chimpactions:customize

Generates:

  • chimpactions view files for administrative interface
  • yourapp/app/views/chimpactions

Configuration

See installed config/chimpactions.yml for configuration options

Usage

What’s available

Once defined (in chimpactions.yml) the local Rails model inherits the following methods from the Chimpactions gem :

  • add_to(List)
  • move_to(List)
  • remove_from(List)

A Chimpaction :

WHENN (A model method/attribute) IS (<,>,=) VALUE, ACTION (Chimpactions method) LIST (One of your MailChimp Lists)

ex.

‘When a user has more than 50 posts, move them to the Power Poster list’

in chimpactions.yml

  action:
    -
    action: :move_to,
    list: Power Posters,
    whenn: posts.count,
    is: >,
    value: 50
    -

for ActiveRecord store
The admin interface should be a straightforward representation.

Administrative Interface

Direct your browser to http://yourapp.chimpactions for a simple CRUD to build and manage Actions.
Available values are set in the forms where applicable, validations will tell you if a value won’t work.

Manual access

You can move subscribers around arbitrarily as well:

user = User.find(123)
user.remove_from("Power Posters") 

Chimpactions Module

All your lists with a ton of info:

@lists = Chimpactions.available_lists
...view
<%= var_dump(@lists) ->

Calling the MailChimp API directly:

Direct access to the gibbon socket :

api_result = Chimpactions.socket.campaigns({:start => 0, :limit => 100})

Webhooks

To register your application with your MailChimp List direct your browser to : http://yourapp/chimpactions/webhooks

The links next to each list will add/delete the webhook http://yourapp/chimpactions/receive to that list.

You must handle the post itself in

 receive_webhook(mc_post_data)  
in your mix-in model for it have an effect.

TODO

  • implement VCR for tests so we don’t have to use a real API key
  • get loading don’t so we don’t have to add include Chimpactions::Subscriber in the model

License

This project released under the MIT-LICENSE.

Thanks

Made possible by the generous support of the MailChimp Integration Fund .

Copyrights

© circuitllc & imgenius 2011 – Released under the MIT license.

chimpactions's People

Contributors

pbonnell avatar chimpchamp-dustin avatar kyleturman avatar

Stargazers

Rob avatar  avatar Jim Caruso avatar Florian Bräuer avatar Peter P. Gengler avatar  avatar Mike Pence avatar Stéphane Busso avatar

Watchers

 avatar Fawad avatar Florian Bräuer avatar  avatar Mohammad Altamash avatar Kashif Saeed avatar M. Mohsin Ali avatar  avatar Nadeem Mukhtar avatar Usman A avatar James Cloos avatar Zaeem Asif avatar Tanzeem Akhtar Bhatti avatar karin avatar  avatar  avatar  avatar

Forkers

filipeamoreira

chimpactions's Issues

rails g chimpactions:install gives error due to using the old Routing DSL

Running rails g chimpaactions on Rails 3.1.3 gives an error:


/Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:252:in `eval_block': You are using the old router DSL which has been removed in Rails 3.1. Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/ or add the rails_legacy_mapper gem to your Gemfile (RuntimeError)
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:235:in `draw'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/chimpactions-0.0.4/config/routes.rb:1:in `<top (required)>'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `each'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:13:in `reload!'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in `call'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/finisher.rb:64:in `call'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/geoffd/projects/rails31/contactogram/config/environment.rb:5:in `<top (required)>'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
    from /Users/geoffd/.rvm/gems/ruby-1.9.3-p0@contactogram/gems/railties-3.1.3/lib/rails/commands.rb:22:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
'''


I have used the workaround of installing the rails_legacy_mapper gem  for now.

MultiJson::DecodeError

MultiJson::DecodeError (756: unexpected token at 'true'):
app/controllers/subscribers_controller.rb:4:in `create'

is there a version i can specify in my gemfile to fix this?

Gibbon::API Constant Error

In lib/chimpactions.rb, on line 103 & 131 it has Gibbon::API.new(self.mailchimp_api_key), but I believe it should be Gibbon.new(self.mailchimp_api_key) with the latest Gibbon gem.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.