hominid 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/hominid.gemspec +2 -2
- data/lib/hominid/base.rb +1 -1
- data/lib/hominid/campaign.rb +50 -2
- data/lib/hominid/helper.rb +52 -11
- data/lib/hominid/list.rb +5 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.4
|
data/hominid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hominid}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Getting", "Michael Str\303\274der"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-17}
|
13
13
|
s.description = %q{Hominid is a Ruby gem that provides a wrapper for interacting with the Mailchimp email marketing service API.}
|
14
14
|
s.email = %q{brian@terra-firma-design.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/hominid/base.rb
CHANGED
@@ -50,7 +50,7 @@ module Hominid
|
|
50
50
|
raise APIError.new(error)
|
51
51
|
end
|
52
52
|
rescue RuntimeError => error
|
53
|
-
if error.message =~ /Wrong type
|
53
|
+
if error.message =~ /Wrong type!/
|
54
54
|
hashes = args.select{|a| a.is_a? Hash}
|
55
55
|
errors = hashes.select{|k, v| v.nil? }.collect{ |k, v| "#{k} is Nil." }.join(' ')
|
56
56
|
raise CommunicationError.new(errors)
|
data/lib/hominid/campaign.rb
CHANGED
@@ -164,9 +164,10 @@ module Hominid
|
|
164
164
|
# Returns:
|
165
165
|
# An array of abuse reports for this list in the format:
|
166
166
|
#
|
167
|
-
def
|
167
|
+
def abuse_reports(campaign_id, start = 0, limit = 500, since = "2000-01-01 00:00:00")
|
168
168
|
call("campaignAbuseReports", campaign_id, start, limit, since)
|
169
169
|
end
|
170
|
+
alias :campaign_abuse_reports :abuse_reports
|
170
171
|
|
171
172
|
# Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
|
172
173
|
# suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary.
|
@@ -182,6 +183,7 @@ module Hominid
|
|
182
183
|
def advice(campaign_id)
|
183
184
|
call("campaignAdvice", campaign_id)
|
184
185
|
end
|
186
|
+
alias :campaign_advice :advice
|
185
187
|
|
186
188
|
# Attach Ecommerce Order Information to a Campaign.
|
187
189
|
#
|
@@ -212,7 +214,7 @@ module Hominid
|
|
212
214
|
order = order.merge(:campaign_id => campaign_id)
|
213
215
|
call("campaignEcommAddOrder", order)
|
214
216
|
end
|
215
|
-
alias :
|
217
|
+
alias :campaign_ecomm_add_order :add_order
|
216
218
|
|
217
219
|
# Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google
|
218
220
|
# Analytics Add-on to be installed and configured.
|
@@ -321,6 +323,18 @@ module Hominid
|
|
321
323
|
end
|
322
324
|
alias :delete_campaign :delete
|
323
325
|
|
326
|
+
# Retrieve the tracked eepurl mentions on Twitter
|
327
|
+
#
|
328
|
+
# Parameters:
|
329
|
+
# * campaign_id (String) = The ID of the campaign.
|
330
|
+
#
|
331
|
+
# Returns:
|
332
|
+
# An array of containing tweets and retweets that include this campaign's eepurl
|
333
|
+
def eep_url_stats(campaign_id)
|
334
|
+
call("campaignEepUrlStats", campaign_id)
|
335
|
+
end
|
336
|
+
alias :campaign_eep_url_stats :eep_url_stats
|
337
|
+
|
324
338
|
# Get the top 5 performing email domains for this campaign.
|
325
339
|
#
|
326
340
|
# Parameters:
|
@@ -385,6 +399,40 @@ module Hominid
|
|
385
399
|
end
|
386
400
|
alias :email_stats_aim_all :email_stats_all
|
387
401
|
|
402
|
+
# Retrieve the countries and number of opens tracked for each.
|
403
|
+
#
|
404
|
+
# Parameters:
|
405
|
+
# * campaign_id (String) = The ID of the campaign.
|
406
|
+
#
|
407
|
+
# Returns:
|
408
|
+
# An array of countries where the campaign was opened:
|
409
|
+
# * code (String) = The ISO3166 2 digit country code.
|
410
|
+
# * name (String) = The country name (if available).
|
411
|
+
# * opens (Integer) = The total number of opens that occurred in the country.
|
412
|
+
# * region_detail (Boolean) = Whether or not a subsequent call to campaignGeoOpensByCountry() will return anything
|
413
|
+
#
|
414
|
+
def geo_opens(campaign_id)
|
415
|
+
call("campaignGeoOpens", campaign_id)
|
416
|
+
end
|
417
|
+
alias :campaign_geo_opens :geo_opens
|
418
|
+
|
419
|
+
# Retrieve the regions and number of opens tracked for a certain country. Email address are not returned.
|
420
|
+
#
|
421
|
+
# Parameters:
|
422
|
+
# * campaign_id (String) = The ID of the campaign.
|
423
|
+
# * code (String) = An ISO3166 2 digit country code.
|
424
|
+
#
|
425
|
+
# Returns:
|
426
|
+
# An array of regions within the provided country where opens occurred:
|
427
|
+
# * code (String) = An internal code for the region. (can be blank)
|
428
|
+
# * name (String) = The name of the region (if available).
|
429
|
+
# * opens (Integer) = The total number of opens that occurred in that region.
|
430
|
+
#
|
431
|
+
def geo_opens_for_country(campaign_id, code)
|
432
|
+
call("campaignGeoOpensForCountry", campaign_id, code)
|
433
|
+
end
|
434
|
+
alias :campaign_geo_opens_for_country :geo_opens_for_country
|
435
|
+
|
388
436
|
# Get all email addresses with Hard Bounces for a given campaign.
|
389
437
|
#
|
390
438
|
# Parameters:
|
data/lib/hominid/helper.rb
CHANGED
@@ -32,20 +32,15 @@ module Hominid
|
|
32
32
|
def account_details
|
33
33
|
hash_to_object(call("getAccountDetails"))
|
34
34
|
end
|
35
|
-
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# Paramters:
|
39
|
-
# * html (String) = Your HTML content.
|
40
|
-
# * strip_css (Boolean) = Whether you want the CSS <style> tags stripped from the returned document. Defaults to false.
|
35
|
+
|
36
|
+
# Get the current Chimp Chatter messages for an account.
|
41
37
|
#
|
42
38
|
# Returns:
|
43
|
-
#
|
39
|
+
# The current Chimp Chatter for an account.
|
44
40
|
#
|
45
|
-
def
|
46
|
-
call("
|
41
|
+
def chatter
|
42
|
+
call("chimpChatter")
|
47
43
|
end
|
48
|
-
alias :convert_css_to_inline :inline_css
|
49
44
|
|
50
45
|
# Create a new folder to file campaigns in.
|
51
46
|
#
|
@@ -54,10 +49,42 @@ module Hominid
|
|
54
49
|
#
|
55
50
|
# Returns:
|
56
51
|
# The folder_id of the newly created folder. (Integer)
|
52
|
+
#
|
57
53
|
def create_folder(name)
|
58
54
|
call("createFolder", name)
|
59
55
|
end
|
60
56
|
|
57
|
+
# Import Ecommerce Order Information to be used for Segmentation.
|
58
|
+
#
|
59
|
+
# Parameters:
|
60
|
+
# * order (Hash) = A hash of order information including:
|
61
|
+
# * id (String) = The order id.
|
62
|
+
# * email_id (String) = Email id of the subscriber. (mc_eid query string) (Required if no email)
|
63
|
+
# * email (String) = Email id of the subscriber. (Required if no email_id)
|
64
|
+
# * total (Double) = Show only campaigns with this from_name.
|
65
|
+
# * order_date (String) = The date of the order. (optional)
|
66
|
+
# * shipping (String) = The total paid for shipping fees. (optional)
|
67
|
+
# * tax (String) = The total tax paid. (optional)
|
68
|
+
# * store_id (String) = A unique id for the store sending the order in
|
69
|
+
# * store_name (String) = A readable name for the store, typicaly the hostname. (optional)
|
70
|
+
# * plugin_id (String) = The MailChimp-assigned Plugin Id. Using 1214 for the moment.
|
71
|
+
# * campaign_id (String) = The campaign ID for this order. (mc_cid query string) (optional)
|
72
|
+
# * items (Array) = The individual line items for an order, using the following keys:
|
73
|
+
# * line_num (Integer) = The line number of the item on the order. (optional)
|
74
|
+
# * product_id (Integer) = Internal product id.
|
75
|
+
# * product_name (String) = The name for the product_id associated with the item.
|
76
|
+
# * category_id (Integer) = Internal id for the (main) category associated with product.
|
77
|
+
# * category_name (String) = The category name for the category id.
|
78
|
+
# * qty (Double) = The quantity of items ordered.
|
79
|
+
# * cost (Double) = The cost of a single item (Ex. Not the extended cost of the line).
|
80
|
+
#
|
81
|
+
# Returns:
|
82
|
+
# True if successful, error code if not.
|
83
|
+
#
|
84
|
+
def ecomm_add_order(order)
|
85
|
+
call("ecommAddOrder", order)
|
86
|
+
end
|
87
|
+
|
61
88
|
# Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content,
|
62
89
|
# an existing Campaign Id, or an existing Template Id. Note that this will not save anything to or update any of
|
63
90
|
# your lists, campaigns, or templates.
|
@@ -73,6 +100,20 @@ module Hominid
|
|
73
100
|
call("generateText", type, content)
|
74
101
|
end
|
75
102
|
|
103
|
+
# Send your HTML content to have the CSS inlined and optionally remove the original styles.
|
104
|
+
#
|
105
|
+
# Parameters:
|
106
|
+
# * html (String) = Your HTML content.
|
107
|
+
# * strip_css (Boolean) = Whether you want the CSS <style> tags stripped from the returned document. Defaults to false.
|
108
|
+
#
|
109
|
+
# Returns:
|
110
|
+
# Your HTML content with all CSS inlined, just like if we sent it. (String)
|
111
|
+
#
|
112
|
+
def inline_css(html, strip_css = false)
|
113
|
+
call("inlineCss", html, strip_css)
|
114
|
+
end
|
115
|
+
alias :convert_css_to_inline :inline_css
|
116
|
+
|
76
117
|
# "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything
|
77
118
|
# is good. Note than unlike most all of our methods, we don't throw an Exception if we are having issues. You will
|
78
119
|
# simply receive a different string back that will explain our view on what is going on.
|
@@ -80,7 +121,7 @@ module Hominid
|
|
80
121
|
# Returns:
|
81
122
|
# "Everything's Chimpy!"
|
82
123
|
#
|
83
|
-
def ping(
|
124
|
+
def ping()
|
84
125
|
call("ping")
|
85
126
|
end
|
86
127
|
|
data/lib/hominid/list.rb
CHANGED
@@ -30,6 +30,11 @@ module Hominid
|
|
30
30
|
def find_list_id_by_web_id(list_web_id)
|
31
31
|
call("lists").find {|list| list["web_id"] == list_web_id}["id"]
|
32
32
|
end
|
33
|
+
|
34
|
+
# Find all the mailing lists IDs that an email address is subscribed to
|
35
|
+
def find_list_ids_by_email(email)
|
36
|
+
call("listForEmail", email)
|
37
|
+
end
|
33
38
|
|
34
39
|
# Get all email addresses that complained about a given list.
|
35
40
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hominid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Getting
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-17 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|