Simple newsletter subscription for Spree stores
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
config
db/migrate
lib
spec
.gitignore
.rspec
Gemfile
LICENSE
README.md
Rakefile
spree_newsletter_subscription.gemspec

README.md

SpreeNewsletterSubscription

Allow simple newsletter subscription on Spree stores.

Supports Mailchimp and Mailup.

Installation

Add spree_newsletter_subscription to your Gemfile:

gem 'spree_newsletter_subscription'

Then for Mailchimp:

gem 'mailchimp-api', '~> 2.0.6'

or for Mailup:

gem 'mailup', '~> 1.2.0'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_newsletter_subscription:install

Configuration

Add your configuration to config/initializers/spree.rb:

Mailchimp example:

SpreeNewsletterSubscription::Config.tap do |config|
  config.provider = 'mailchimp'
  config.provider_config = {
    api_key: 'xxxxxxxxxxxxx-us9',
    list_id: 'xxxxxxxxx'
  }
end

Mailup example:

SpreeNewsletterSubscription::Config.tap do |config|
  config.provider = 'mailup'
  config.provider_config = {
    client_id: 'xxxxxxxxx',
    client_secret: 'xxxxxxxxx',
    username: 'xxxxxxxxx',
    password: 'xxxxxxxxx',
    list_id: 'xxxxxxxxx',
    group_id: 'xxxx' # optional
  }
end

You can have different config values for each locale. If missing, the default is always used. For example:

SpreeNewsletterSubscription::Config.tap do |config|
  config.provider_config = {
    list_id: 'xxxxxxxxx',
    en: {
      list_id: 'yyyyyyyy' # use a different value, only for locale :en
    }
  }
end

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_newsletter_subscription/factories'

Copyright (c) 2015 Alessandro Lepore, released under the New BSD License