devise_mailchimp 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -43,6 +43,8 @@ go to the Lists tab, then hit create list.
|
|
43
43
|
|
44
44
|
Devise.mailing_list_name = 'List Name'
|
45
45
|
|
46
|
+
For all the configuration settings, take a look at the {model documenation}[http://rubydoc.info/github/jcnnghm/devise_mailchimp/master/Devise/Models/Mailchimp#].
|
47
|
+
|
46
48
|
== Documentation
|
47
49
|
|
48
50
|
Full documentation is available at {rdoc.info}[http://rdoc.info/github/jcnnghm/devise_mailchimp/master/frames].
|
@@ -81,6 +83,8 @@ If all users will join the same list or lists, just set the mailing_list_name co
|
|
81
83
|
|
82
84
|
Please help this software improve by submitting pull requests, preferably with tests.
|
83
85
|
|
86
|
+
View our {contributors}[https://github.com/jcnnghm/devise_mailchimp/contributors].
|
87
|
+
|
84
88
|
== Copyright
|
85
89
|
|
86
90
|
Copyright (c) 2011 {Justin Cunningham}[http://littlebitofcode.com]. See MIT_LICENSE for details.
|
@@ -7,8 +7,9 @@ module Devise
|
|
7
7
|
LIST_CACHE_KEY = "devise_mailchimp/lists"
|
8
8
|
|
9
9
|
# craete a new ApiMapper with the provided API key
|
10
|
-
def initialize(api_key)
|
10
|
+
def initialize(api_key, double_opt_in)
|
11
11
|
@api_key = api_key
|
12
|
+
@double_opt_in = double_opt_in
|
12
13
|
end
|
13
14
|
|
14
15
|
# looks the name up in the cache. if it doesn't find it, looks it up using the api and saves it to the cache
|
@@ -36,7 +37,7 @@ module Devise
|
|
36
37
|
list_names = [list_names] unless list_names.is_a?(Array)
|
37
38
|
list_names.each do |list_name|
|
38
39
|
list_id = name_to_id(list_name)
|
39
|
-
hominid.list_subscribe(list_id, email, {}, 'html',
|
40
|
+
hominid.list_subscribe(list_id, email, {}, 'html', @double_opt_in, true, true, false)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -18,6 +18,9 @@ module Devise
|
|
18
18
|
# account tab in your MailChimp account and select API Keys & Authorized Apps, then add
|
19
19
|
# a key. This defaults to 'your_api_key'
|
20
20
|
#
|
21
|
+
# double_opt_in: Requires that users must click a link in a confirmation email to be added to your mailing list.
|
22
|
+
# Defaults to false.
|
23
|
+
#
|
21
24
|
# Examples:
|
22
25
|
#
|
23
26
|
# User.find(1).add_to_mailchimp_list('Site Administrators List')
|
@@ -73,14 +76,15 @@ module Devise
|
|
73
76
|
|
74
77
|
# mapper that helps convert list names to mailchimp ids
|
75
78
|
def mailchimp_list_mapper
|
76
|
-
@@mailchimp_list_mapper ||= MailchimpListApiMapper.new(self.class.mailchimp_api_key)
|
79
|
+
@@mailchimp_list_mapper ||= MailchimpListApiMapper.new(self.class.mailchimp_api_key, self.class.double_opt_in)
|
77
80
|
end
|
78
81
|
|
79
82
|
module ClassMethods
|
80
83
|
Devise::Models.config(self, :mailchimp_api_key)
|
81
84
|
Devise::Models.config(self, :mailing_list_name)
|
82
85
|
Devise::Models.config(self, :mailing_list_opt_in_by_default)
|
86
|
+
Devise::Models.config(self, :double_opt_in)
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
86
|
-
end
|
90
|
+
end
|
data/lib/devise_mailchimp.rb
CHANGED
@@ -35,8 +35,17 @@ module Devise
|
|
35
35
|
# Devise.mailchimp_api_key = "your_api_key"
|
36
36
|
mattr_accessor :mailchimp_api_key
|
37
37
|
@@mailchimp_api_key = 'your_api_key'
|
38
|
+
|
39
|
+
# Public: Require double opt-in
|
40
|
+
# Requires user to click a link in a confirmation email to be added to the mailing list. Defaults
|
41
|
+
# to false.
|
42
|
+
#
|
43
|
+
# Devise.double_opt_in = false
|
44
|
+
mattr_accessor :double_opt_in
|
45
|
+
@@double_opt_in = false
|
46
|
+
|
38
47
|
end
|
39
48
|
|
40
49
|
Devise.add_module :mailchimp, :model => 'devise_mailchimp/model'
|
41
50
|
|
42
|
-
require 'devise_mailchimp/mailchimp_list_api_mapper'
|
51
|
+
require 'devise_mailchimp/mailchimp_list_api_mapper'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Cunningham
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-11-13 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rails
|
@@ -95,7 +94,6 @@ files:
|
|
95
94
|
- lib/devise_mailchimp/mailchimp_list_api_mapper.rb
|
96
95
|
- lib/devise_mailchimp/model.rb
|
97
96
|
- lib/devise_mailchimp/version.rb
|
98
|
-
has_rdoc: true
|
99
97
|
homepage: http://jcnnghm.github.com/devise_mailchimp/
|
100
98
|
licenses: []
|
101
99
|
|
@@ -125,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
123
|
requirements: []
|
126
124
|
|
127
125
|
rubyforge_project: devise_mailchimp
|
128
|
-
rubygems_version: 1.
|
126
|
+
rubygems_version: 1.8.10
|
129
127
|
signing_key:
|
130
128
|
specification_version: 3
|
131
129
|
summary: Easy MailChimp integration for Devise
|