README.md in mailkick-0.0.3 vs README.md in mailkick-0.0.4

- old
+ new

@@ -52,11 +52,11 @@ ## Sending Emails Before sending marketing emails, make sure the user has not opted out. -Add the following the method to your user model. +Add the following method to models with email addresses. ```ruby class User < ActiveRecord::Base mailkick_user end @@ -66,11 +66,11 @@ ```ruby User.opted_out ``` -And those who have not (send to these people) +And those who have not - send to these people ```ruby User.not_opted_out ``` @@ -78,22 +78,10 @@ ```ruby user.opted_out? ``` -Unsubscribe - -```ruby -user.opt_out -``` - -Resubscribe - -```ruby -user.opt_in -``` - ## Bounces and Spam Reports Fetch bounces, spam reports, and unsubscribes from your email service. ```ruby @@ -159,45 +147,28 @@ ``` Pass the `list` option to methods. ```ruby -# scopes User.opted_out(list: "order_reminders") User.not_opted_out(list: "order_reminders") - -# instance methods user.opted_out?(list: "order_reminders") -user.opt_out(list: "order_reminders") -user.opt_in(list: "order_reminders") ``` -Omitting list (`nil` list) means all lists - including future lists (think “Unsubscribe All”). - -```ruby -# opted out of all lists? -user.opted_out? - -# opted out of the order reminder list *or* all lists? -user.opted_out?(list: "order_reminders") -``` - ### Opt-In Lists For opt-in lists, you’ll need to manage the subscribers yourself. -Mailkick stores opt-outs, which you can combine with opt-ins. +Check opt-ins against the opt-outs ```ruby -# opt-ins minus opt-outs User.where(send_me_sales: true).not_opted_out(list: "sales") ``` Check one user ```ruby -# opted in and didn't opt out user.send_me_sales && !user.opted_out?(list: "sales") ``` ## Bonus @@ -210,9 +181,27 @@ Change how the user is determined ```ruby Mailkick.user_method = proc {|email| User.where(email: email).first } +``` + +Use a different email field + +```ruby +mailkick_user email_key: :email_address +``` + +Unsubscribe + +```ruby +user.opt_out +``` + +Resubscribe + +```ruby +user.opt_in ``` ## History View the [changelog](https://github.com/ankane/mailkick/blob/master/CHANGELOG.md)