bgetting-hominid 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +5 -1
- data/VERSION.yml +2 -2
- data/lib/hominid.rb +34 -16
- metadata +2 -2
data/README.textile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
h1. Hominid
|
2
2
|
|
3
|
-
Hominid is a GemPlugin wrapper to the Mailchimp API.
|
3
|
+
Hominid is a GemPlugin wrapper to the "Mailchimp API":http://www.mailchimp.com/api/1.2/.
|
4
4
|
|
5
5
|
h2. Installation
|
6
6
|
|
@@ -45,6 +45,10 @@ To unsubscribe someone:
|
|
45
45
|
|
46
46
|
To update a list member:
|
47
47
|
|
48
|
+
<pre><code>@hominid.subscribe(@list_id, "email@example.com", {:FNAME => 'Robert', :EMAIL => 'another@example.com'}, 'html', true)</code></pre>
|
49
|
+
|
50
|
+
_or_
|
51
|
+
|
48
52
|
<pre><code>@hominid.update_member(@list_id, "email@example.com", {:FNAME => 'Robert', :EMAIL => 'another@example.com'})</code></pre>
|
49
53
|
|
50
54
|
Campaign methods are also supported. You can get all the campaigns for a particular list by:
|
data/VERSION.yml
CHANGED
data/lib/hominid.rb
CHANGED
@@ -2,7 +2,7 @@ require 'xmlrpc/client'
|
|
2
2
|
|
3
3
|
class Hominid
|
4
4
|
|
5
|
-
# MailChimp API Documentation: http://www.mailchimp.com/api/1.
|
5
|
+
# MailChimp API Documentation: http://www.mailchimp.com/api/1.2/
|
6
6
|
|
7
7
|
def initialize(autologin = true)
|
8
8
|
load_monkey_brains
|
@@ -21,7 +21,7 @@ class Hominid
|
|
21
21
|
|
22
22
|
def login
|
23
23
|
begin
|
24
|
-
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.
|
24
|
+
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.2/")
|
25
25
|
@api_key = @chimpApi.call("login", @chimpUsername, @chimpPassword)
|
26
26
|
rescue
|
27
27
|
puts "***** Mail Chimp Error *****"
|
@@ -33,7 +33,7 @@ class Hominid
|
|
33
33
|
|
34
34
|
def add_api_key(key)
|
35
35
|
begin
|
36
|
-
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.
|
36
|
+
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.2/")
|
37
37
|
@chimpApi.call("apikeyAdd", @chimpUsername, @chimpPassword, key)
|
38
38
|
rescue
|
39
39
|
false
|
@@ -42,7 +42,7 @@ class Hominid
|
|
42
42
|
|
43
43
|
def expire_api_key(key)
|
44
44
|
begin
|
45
|
-
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.
|
45
|
+
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.2/")
|
46
46
|
@chimpApi.call("apikeyExpire", @chimpUsername, @chimpPassword, key)
|
47
47
|
rescue
|
48
48
|
false
|
@@ -51,7 +51,7 @@ class Hominid
|
|
51
51
|
|
52
52
|
def api_keys(include_expired = false)
|
53
53
|
begin
|
54
|
-
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.
|
54
|
+
@chimpApi ||= XMLRPC::Client.new2("http://api.mailchimp.com/1.2/")
|
55
55
|
@api_keys = @chimpApi.call("apikeys", @chimpUsername, @chimpPassword, @api_key, include_expired)
|
56
56
|
rescue
|
57
57
|
return nil
|
@@ -69,14 +69,23 @@ class Hominid
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
def campaigns(
|
73
|
-
# Get the campaigns for this account
|
72
|
+
def campaigns(filters = {}, start = 0, limit = 50)
|
73
|
+
# Get the campaigns for this account
|
74
|
+
# API Version 1.2 requires that filters be sent as a hash
|
75
|
+
# Available options for the filters hash are:
|
76
|
+
#
|
77
|
+
# :campaign_id = (string) The ID of the campaign you wish to return.
|
78
|
+
# :list_id = (string) Show only campaigns with this list_id.
|
79
|
+
# :folder_id = (integer) Show only campaigns from this folder.
|
80
|
+
# :from_name = (string) Show only campaigns with this from_name.
|
81
|
+
# :from_email = (string) Show only campaigns with this from_email.
|
82
|
+
# :title = (string) Show only campaigns with this title.
|
83
|
+
# :subject = (string) Show only campaigns with this subject.
|
84
|
+
# :sedtime_start = (string) Show campaigns sent after YYYY-MM-DD HH:mm:ss.
|
85
|
+
# :sendtime_end = (string) Show campaigns sent before YYYY-MM-DD HH:mm:ss.
|
86
|
+
# :subject = (boolean) Filter by exact values, or search within content for filter values.
|
74
87
|
begin
|
75
|
-
|
76
|
-
@campaigns = @chimpApi.call("campaigns", @api_key, list_id)
|
77
|
-
else
|
78
|
-
@campaigns = @chimpApi.call("campaigns", @api_key)
|
79
|
-
end
|
88
|
+
@campaigns = @chimpApi.call("campaigns", @api_key, filters, start, limit)
|
80
89
|
rescue
|
81
90
|
return nil
|
82
91
|
end
|
@@ -249,10 +258,19 @@ class Hominid
|
|
249
258
|
end
|
250
259
|
end
|
251
260
|
|
252
|
-
def members(list_id, status = "subscribed")
|
261
|
+
def members(list_id, status = "subscribed", since = "2000-01-01 00:00:00", start = 0, limit = 100)
|
253
262
|
# Get members of a list based on status
|
263
|
+
# Select members based on one of the following statuses:
|
264
|
+
# 'subscribed'
|
265
|
+
# 'unsubscribed'
|
266
|
+
# 'cleaned'
|
267
|
+
# 'updated'
|
268
|
+
#
|
269
|
+
# Select members that have updated their status or profile by providing
|
270
|
+
# a "since" date in the format of YYYY-MM-DD HH:MM:SS
|
271
|
+
#
|
254
272
|
begin
|
255
|
-
@members = @chimpApi.call("listMembers", @api_key, list_id, status)
|
273
|
+
@members = @chimpApi.call("listMembers", @api_key, list_id, status, since, start, limit)
|
256
274
|
rescue
|
257
275
|
return nil
|
258
276
|
end
|
@@ -267,10 +285,10 @@ class Hominid
|
|
267
285
|
end
|
268
286
|
end
|
269
287
|
|
270
|
-
def subscribe(list_id, email, user_info = {}, email_type = "html")
|
288
|
+
def subscribe(list_id, email, user_info = {}, email_type = "html", update_existing = true, replace_interests = true)
|
271
289
|
# Subscribe a member
|
272
290
|
begin
|
273
|
-
@chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, @double_opt)
|
291
|
+
@chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, @double_opt, update_existing, replace_interests)
|
274
292
|
rescue
|
275
293
|
false
|
276
294
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bgetting-hominid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Getting
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|