hominid 2.0.0 → 2.0.1
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 +2 -2
- data/VERSION +1 -1
- data/hominid.gemspec +2 -2
- data/hominid.yml.tpl +3 -3
- data/lib/hominid/base.rb +8 -3
- data/lib/hominid/campaign.rb +2 -2
- data/lib/hominid/helper.rb +11 -11
- metadata +2 -2
data/README.textile
CHANGED
@@ -4,7 +4,7 @@ Hominid is a Ruby gem that provides a wrapper for interacting with the "Mailchim
|
|
4
4
|
|
5
5
|
h2. Installation
|
6
6
|
|
7
|
-
<pre><code>sudo gem install hominid, :version => '>= 2.0.
|
7
|
+
<pre><code>sudo gem install hominid, :version => '>= 2.0.1', :source => "http://gemcutter.org"</code></pre>
|
8
8
|
|
9
9
|
Hominid is hosted at "Gemcutter":http://gemcutter.org. Be sure that you have the Gemcutter gem installed if you are having trouble installing Hominid:
|
10
10
|
|
@@ -108,7 +108,7 @@ h2. Syncing Your Application
|
|
108
108
|
|
109
109
|
If you are integrating an application with Mailchimp, Hominid will provide a way for your app to connect with your Mailchimp account. However, it does not provide a way for Mailchimp to connect to your application, which is why Mailchimp has implemented "web hooks":http://www.mailchimp.com/api/webhooks/.
|
110
110
|
|
111
|
-
The _Hominid::
|
111
|
+
The _Hominid::Webhook_ class helps with receiving <tt>POST</tt> data from a Mailchimp webhook:
|
112
112
|
|
113
113
|
<pre><code>hook = Hominid::Webhook.new(params)
|
114
114
|
case hook.event
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.1
|
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.1"
|
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{2009-
|
12
|
+
s.date = %q{2009-11-11}
|
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/hominid.yml.tpl
CHANGED
@@ -6,7 +6,7 @@ development:
|
|
6
6
|
api_key:
|
7
7
|
send_goodbye: false
|
8
8
|
send_notify: false
|
9
|
-
|
9
|
+
double_opt_in: false
|
10
10
|
|
11
11
|
test:
|
12
12
|
username:
|
@@ -14,7 +14,7 @@ test:
|
|
14
14
|
api_key:
|
15
15
|
send_goodbye: false
|
16
16
|
send_notify: false
|
17
|
-
|
17
|
+
double_opt_in: false
|
18
18
|
|
19
19
|
production:
|
20
20
|
username:
|
@@ -22,4 +22,4 @@ production:
|
|
22
22
|
api_key:
|
23
23
|
send_goodbye: false
|
24
24
|
send_notify: false
|
25
|
-
|
25
|
+
double_opt_in: false
|
data/lib/hominid/base.rb
CHANGED
@@ -14,9 +14,14 @@ module Hominid
|
|
14
14
|
:double_opt_in => false,
|
15
15
|
:update_existing => true,
|
16
16
|
:replace_interests => true,
|
17
|
-
:merge_tags => {}
|
17
|
+
:merge_tags => {},
|
18
|
+
:secure => false}
|
18
19
|
@config = defaults.merge(config).freeze
|
19
|
-
|
20
|
+
if config[:secure]
|
21
|
+
@chimpApi = XMLRPC::Client.new2("https://#{api_endpoint}.api.mailchimp.com/#{MAILCHIMP_API_VERSION}/")
|
22
|
+
else
|
23
|
+
@chimpApi = XMLRPC::Client.new2("http://#{api_endpoint}.api.mailchimp.com/#{MAILCHIMP_API_VERSION}/")
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
# Security related methods
|
@@ -67,7 +72,7 @@ module Hominid
|
|
67
72
|
when 233, 215
|
68
73
|
raise NotSubscribed.new(error)
|
69
74
|
else
|
70
|
-
raise
|
75
|
+
raise APIError.new(error)
|
71
76
|
end
|
72
77
|
rescue RuntimeError => error
|
73
78
|
if error.message =~ /Wrong type NilClass\. Not allowed!/
|
data/lib/hominid/campaign.rb
CHANGED
@@ -49,7 +49,7 @@ module Hominid
|
|
49
49
|
|
50
50
|
def self.find_by_web_id(web_id)
|
51
51
|
# Find campaigns by web_id
|
52
|
-
all.find { |campaign| campaign.attributes['web_id']
|
52
|
+
all.find { |campaign| campaign.attributes['web_id'] == web_id.to_i }
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.find_by_id(id)
|
@@ -116,7 +116,7 @@ module Hominid
|
|
116
116
|
# :category_name = (string) the category name for the category id
|
117
117
|
# :qty = (double) the quantity of items ordered
|
118
118
|
# :cost = (double) the cost of a single item (i.e., not the extended cost of the line)
|
119
|
-
order.merge(:campaign_id => @campaign_id)
|
119
|
+
order = order.merge(:campaign_id => @campaign_id)
|
120
120
|
call("campaignEcommAddOrder", order)
|
121
121
|
end
|
122
122
|
|
data/lib/hominid/helper.rb
CHANGED
@@ -5,22 +5,22 @@ module Hominid
|
|
5
5
|
# Helper methods
|
6
6
|
# --------------------------------
|
7
7
|
|
8
|
-
def self.account_details
|
8
|
+
def self.account_details(options = {})
|
9
9
|
# Get details for this account.
|
10
|
-
new.call("getAccountDetails")
|
10
|
+
new(options).call("getAccountDetails")
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.convert_css_to_inline(html, strip_css = false)
|
13
|
+
def self.convert_css_to_inline(html, strip_css = false, options = {})
|
14
14
|
# Convert CSS styles to inline styles and (optionally) remove original styles
|
15
15
|
new.call("inlineCss", html, strip_css)
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.create_folder(name)
|
18
|
+
def self.create_folder(name, options = {})
|
19
19
|
# Create a new folder to file campaigns in
|
20
|
-
new.call("createFolder", name)
|
20
|
+
new(options).call("createFolder", name)
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.generate_text(type, content)
|
23
|
+
def self.generate_text(type, content, options = {})
|
24
24
|
# Have HTML content auto-converted to a text-only format.
|
25
25
|
# The options for text type are:
|
26
26
|
# 'html' => Expects a string of HTML(default).
|
@@ -28,17 +28,17 @@ module Hominid
|
|
28
28
|
# 'url' => Expects a valid and public URL.
|
29
29
|
# 'cid' => Expects a campaign ID.
|
30
30
|
# 'tid' => Expects a template ID.
|
31
|
-
new.call("generateText", type, content)
|
31
|
+
new(options).call("generateText", type, content)
|
32
32
|
end
|
33
33
|
|
34
|
-
def self.html_to_text(content)
|
34
|
+
def self.html_to_text(content, options = {})
|
35
35
|
# Convert HTML content to text
|
36
|
-
new.call("generateText", 'html', content)
|
36
|
+
new(options).call("generateText", 'html', content)
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.ping
|
39
|
+
def self.ping(options = {})
|
40
40
|
# Ping the Mailchimp API
|
41
|
-
new.call("ping")
|
41
|
+
new(options).call("ping")
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
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.1
|
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: 2009-
|
13
|
+
date: 2009-11-11 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|