hominid 2.2.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -0
- data/Gemfile.lock +23 -0
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.rdoc +34 -93
- data/Rakefile +26 -36
- data/VERSION +1 -1
- data/hominid.gemspec +38 -33
- data/lib/hominid.rb +52 -27
- data/lib/hominid/campaign.rb +16 -680
- data/lib/hominid/list.rb +8 -452
- data/lib/hominid/security.rb +10 -34
- data/test/{test_helper.rb → helper.rb} +8 -0
- data/test/test_hominid.rb +29 -0
- metadata +65 -38
- data/.gitignore +0 -5
- data/lib/hominid/base.rb +0 -122
- data/lib/hominid/helper.rb +0 -129
- data/test/hominid_test.rb +0 -12
data/lib/hominid/security.rb
CHANGED
@@ -1,43 +1,19 @@
|
|
1
1
|
module Hominid
|
2
2
|
module Security
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
# * username (String) = Your Mailchimp account username.
|
8
|
-
# * password (String) = Your Mailchimp account password.
|
9
|
-
#
|
10
|
-
# Returns:
|
11
|
-
# A new API Key that can be immediately used.
|
12
|
-
#
|
13
|
-
def add_api_key(username, password)
|
14
|
-
@chimpApi.call("apikeyAdd", username, password, @config[:api_key])
|
3
|
+
|
4
|
+
# Get a list of all API keys
|
5
|
+
def apikeys(username, password, expired = false)
|
6
|
+
@chimpApi.call("apikeys", username, password, @api_key, expired)
|
15
7
|
end
|
16
8
|
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
# * username (String) = Your Mailchimp account username.
|
21
|
-
# * password (String) = Your Mailchimp account password.
|
22
|
-
# * expired (Boolean) = Whether or not to include expired keys, defaults to false.
|
23
|
-
#
|
24
|
-
# Returns:
|
25
|
-
# An array of API keys including:
|
26
|
-
# * apikey (String) = The api key that can be used.
|
27
|
-
# * created_at (String) = The date the key was created.
|
28
|
-
# * expired_at (String) = The date the key was expired.
|
29
|
-
#
|
30
|
-
def api_keys(username, password, expired = false)
|
31
|
-
@chimpApi.call("apikeys", username, password, @config[:api_key], expired)
|
9
|
+
# Add an API key to your account
|
10
|
+
def apikey_add(username, password)
|
11
|
+
@chimpApi.call("apikeyAdd", username, password, @api_key)
|
32
12
|
end
|
33
13
|
|
34
|
-
# Expire a
|
35
|
-
|
36
|
-
|
37
|
-
# True if successful, error code if not.
|
38
|
-
#
|
39
|
-
def expire_api_key(username, password)
|
40
|
-
@chimpApi.call("apikeyExpire", username, password, @config[:api_key])
|
14
|
+
# Expire a specific API key
|
15
|
+
def apikey_expire(username, password, api_key)
|
16
|
+
@chimpApi.call("apikeyExpire", username, password, api_key)
|
41
17
|
end
|
42
18
|
|
43
19
|
end
|
@@ -1,4 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
2
10
|
require 'test/unit'
|
3
11
|
require 'shoulda'
|
4
12
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestHominid < Test::Unit::TestCase
|
4
|
+
|
5
|
+
VALID_API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us1'
|
6
|
+
INVALID_API_KEY = 'not_a_valid_api_key'
|
7
|
+
|
8
|
+
should "not raise an error if the API key is valid" do
|
9
|
+
assert_nothing_raised do
|
10
|
+
Hominid::API.new(VALID_API_KEY)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
should "raise an error if the API key is not provided" do
|
15
|
+
assert_raise(ArgumentError) do
|
16
|
+
Hominid::API.new()
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
should "raise an error if the API key is malformed" do
|
21
|
+
assert_raise(ArgumentError) do
|
22
|
+
Hominid::API.new(INVALID_API_KEY)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# TODO: Tests that mock API calls so that it is not hitting the actual
|
27
|
+
# Mailchimp API during testing.
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,68 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hominid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 7
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
|
-
-
|
8
|
-
- 2
|
6
|
+
- 3
|
9
7
|
- 0
|
10
|
-
|
8
|
+
- 1
|
9
|
+
version: 3.0.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Brian Getting
|
14
|
-
- "Michael Str\xC3\xBCder"
|
15
13
|
autorequire:
|
16
14
|
bindir: bin
|
17
15
|
cert_chain: []
|
18
16
|
|
19
|
-
date: 2010-
|
17
|
+
date: 2010-12-20 00:00:00 -08:00
|
20
18
|
default_executable:
|
21
19
|
dependencies:
|
22
20
|
- !ruby/object:Gem::Dependency
|
23
|
-
name:
|
24
|
-
prerelease: false
|
21
|
+
name: bundler
|
25
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
23
|
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 31
|
31
27
|
segments:
|
32
28
|
- 1
|
33
|
-
- 2
|
34
29
|
- 0
|
35
|
-
|
36
|
-
|
30
|
+
- 0
|
31
|
+
version: 1.0.0
|
32
|
+
type: :development
|
33
|
+
prerelease: false
|
37
34
|
version_requirements: *id001
|
38
35
|
- !ruby/object:Gem::Dependency
|
39
36
|
name: jeweler
|
40
|
-
prerelease: false
|
41
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
38
|
none: false
|
43
39
|
requirements:
|
44
|
-
- -
|
40
|
+
- - ~>
|
45
41
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 3
|
47
42
|
segments:
|
48
|
-
-
|
49
|
-
|
43
|
+
- 1
|
44
|
+
- 5
|
45
|
+
- 2
|
46
|
+
version: 1.5.2
|
50
47
|
type: :development
|
48
|
+
prerelease: false
|
51
49
|
version_requirements: *id002
|
52
50
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
54
|
-
prerelease: false
|
51
|
+
name: mocha
|
55
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
53
|
none: false
|
57
54
|
requirements:
|
58
55
|
- - ">="
|
59
56
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
57
|
segments:
|
62
58
|
- 0
|
63
|
-
|
59
|
+
- 9
|
60
|
+
- 10
|
61
|
+
version: 0.9.10
|
64
62
|
type: :development
|
63
|
+
prerelease: false
|
65
64
|
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rcov
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 9
|
75
|
+
- 9
|
76
|
+
version: 0.9.9
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: shoulda
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 2
|
89
|
+
- 11
|
90
|
+
- 3
|
91
|
+
version: 2.11.3
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: *id005
|
66
95
|
description: Hominid is a Ruby gem that provides a wrapper for interacting with the Mailchimp email marketing service API.
|
67
96
|
email: brian@terra-firma-design.com
|
68
97
|
executables: []
|
@@ -70,30 +99,29 @@ executables: []
|
|
70
99
|
extensions: []
|
71
100
|
|
72
101
|
extra_rdoc_files:
|
73
|
-
- LICENSE
|
102
|
+
- LICENSE.txt
|
74
103
|
- README.rdoc
|
75
104
|
files:
|
76
|
-
-
|
77
|
-
-
|
105
|
+
- Gemfile
|
106
|
+
- Gemfile.lock
|
107
|
+
- LICENSE.txt
|
78
108
|
- README.rdoc
|
79
109
|
- Rakefile
|
80
110
|
- VERSION
|
81
111
|
- hominid.gemspec
|
82
112
|
- lib/hominid.rb
|
83
|
-
- lib/hominid/base.rb
|
84
113
|
- lib/hominid/campaign.rb
|
85
|
-
- lib/hominid/helper.rb
|
86
114
|
- lib/hominid/list.rb
|
87
115
|
- lib/hominid/security.rb
|
88
|
-
- test/
|
89
|
-
- test/
|
116
|
+
- test/helper.rb
|
117
|
+
- test/test_hominid.rb
|
90
118
|
has_rdoc: true
|
91
119
|
homepage: http://github.com/bgetting/hominid
|
92
|
-
licenses:
|
93
|
-
|
120
|
+
licenses:
|
121
|
+
- MIT
|
94
122
|
post_install_message:
|
95
|
-
rdoc_options:
|
96
|
-
|
123
|
+
rdoc_options: []
|
124
|
+
|
97
125
|
require_paths:
|
98
126
|
- lib
|
99
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -101,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
129
|
requirements:
|
102
130
|
- - ">="
|
103
131
|
- !ruby/object:Gem::Version
|
104
|
-
hash:
|
132
|
+
hash: -1643748069951244742
|
105
133
|
segments:
|
106
134
|
- 0
|
107
135
|
version: "0"
|
@@ -110,7 +138,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
138
|
requirements:
|
111
139
|
- - ">="
|
112
140
|
- !ruby/object:Gem::Version
|
113
|
-
hash: 3
|
114
141
|
segments:
|
115
142
|
- 0
|
116
143
|
version: "0"
|
@@ -120,7 +147,7 @@ rubyforge_project:
|
|
120
147
|
rubygems_version: 1.3.7
|
121
148
|
signing_key:
|
122
149
|
specification_version: 3
|
123
|
-
summary: Hominid is a Ruby
|
150
|
+
summary: Hominid is a Ruby wrapper for the Mailchimp API
|
124
151
|
test_files:
|
125
|
-
- test/
|
126
|
-
- test/
|
152
|
+
- test/helper.rb
|
153
|
+
- test/test_hominid.rb
|
data/lib/hominid/base.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
module Hominid
|
2
|
-
class Base
|
3
|
-
include Hominid::Campaign
|
4
|
-
include Hominid::Helper
|
5
|
-
include Hominid::List
|
6
|
-
include Hominid::Security
|
7
|
-
|
8
|
-
# MailChimp API Documentation: http://www.mailchimp.com/api/1.2/
|
9
|
-
MAILCHIMP_API_VERSION = "1.2"
|
10
|
-
MAILCHIMP_EXPORT_API_VERSION = "1.0"
|
11
|
-
MAILCHIMP_EXPORT_PATH = "/export/#{MAILCHIMP_EXPORT_API_VERSION}/list/"
|
12
|
-
|
13
|
-
def initialize(config = {})
|
14
|
-
raise StandardError.new('Please provide your Mailchimp API key.') unless config[:api_key]
|
15
|
-
raise ArgumentError.new('Your Mailchimp API key is malformatted.') unless config[:api_key].include?('-')
|
16
|
-
dc = config[:api_key].split('-').last
|
17
|
-
defaults = {
|
18
|
-
:double_opt_in => false,
|
19
|
-
:merge_tags => {},
|
20
|
-
:replace_interests => true,
|
21
|
-
:secure => false,
|
22
|
-
:send_goodbye => false,
|
23
|
-
:send_notify => false,
|
24
|
-
:send_welcome => false,
|
25
|
-
:timeout => nil,
|
26
|
-
:update_existing => true
|
27
|
-
}
|
28
|
-
@config = defaults.merge(config).freeze
|
29
|
-
if config[:secure]
|
30
|
-
@chimpApi = XMLRPC::Client.new2("https://#{dc}.api.mailchimp.com/#{MAILCHIMP_API_VERSION}/", nil, config[:timeout])
|
31
|
-
@exportApi = Net::HTTP.new("#{dc}.api.mailchimp.com", 443)
|
32
|
-
else
|
33
|
-
@chimpApi = XMLRPC::Client.new2("http://#{dc}.api.mailchimp.com/#{MAILCHIMP_API_VERSION}/", nil, config[:timeout])
|
34
|
-
@exportApi = Net::HTTP.new("#{dc}.api.mailchimp.com", 80)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def apply_defaults_to(options) # :nodoc:
|
39
|
-
@config.merge(options)
|
40
|
-
end
|
41
|
-
|
42
|
-
def call(method, *args) # :nodoc:
|
43
|
-
@chimpApi.call(method, @config[:api_key], *args)
|
44
|
-
rescue XMLRPC::FaultException => error
|
45
|
-
# Handle common cases for which the Mailchimp API would raise Exceptions
|
46
|
-
case error.faultCode
|
47
|
-
when 100..199
|
48
|
-
raise UserError.new(error)
|
49
|
-
when 200..299
|
50
|
-
raise ListError.new(error)
|
51
|
-
when 300..399
|
52
|
-
raise CampaignError.new(error)
|
53
|
-
when 500..599
|
54
|
-
raise ValidationError.new(error)
|
55
|
-
else
|
56
|
-
raise APIError.new(error)
|
57
|
-
end
|
58
|
-
rescue RuntimeError => error
|
59
|
-
if error.message =~ /Wrong type!/
|
60
|
-
hashes = args.select{|a| a.is_a? Hash}
|
61
|
-
errors = hashes.select{|k, v| v.nil? }.collect{ |k, v| "#{k} is Nil." }.join(' ')
|
62
|
-
raise CommunicationError.new(errors)
|
63
|
-
else
|
64
|
-
raise error
|
65
|
-
end
|
66
|
-
rescue Exception => error
|
67
|
-
raise CommunicationError.new(error.message)
|
68
|
-
end
|
69
|
-
|
70
|
-
def call_export(list_id, status)
|
71
|
-
uri = "#{MAILCHIMP_EXPORT_PATH}?apikey=#{@config[:api_key]}&id=#{list_id}"
|
72
|
-
|
73
|
-
!status.nil? && uri += "&status=#{status}"
|
74
|
-
|
75
|
-
# Don't parse the whole thing since there could be thousands of records
|
76
|
-
out, keys = [], []
|
77
|
-
body = @exportApi.request_get(uri).body
|
78
|
-
lines = body.send(body.respond_to?(:lines) ? :lines : :to_s).to_a
|
79
|
-
|
80
|
-
lines.each_with_index do |l, i|
|
81
|
-
if i == 0
|
82
|
-
keys = JSON.parse(l).map { |k| k.gsub(" ", "_") }
|
83
|
-
else
|
84
|
-
# Magic! http://snippets.dzone.com/posts/show/302
|
85
|
-
out << Hash[*keys.zip(JSON.parse(l)).flatten]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
out
|
89
|
-
rescue Exception => error
|
90
|
-
raise CommunicationError.new(error.message)
|
91
|
-
end
|
92
|
-
|
93
|
-
def clean_merge_tags(merge_tags) # :nodoc:
|
94
|
-
return {} unless merge_tags.is_a? Hash
|
95
|
-
merge_tags.each do |key, value|
|
96
|
-
if merge_tags[key].is_a? String
|
97
|
-
merge_tags[key] = value.gsub("\v", '')
|
98
|
-
elsif merge_tags[key].nil?
|
99
|
-
merge_tags[key] = ''
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def hash_to_object(object) # :nodoc:
|
105
|
-
return case object
|
106
|
-
when Hash
|
107
|
-
object = object.clone
|
108
|
-
object.each do |key, value|
|
109
|
-
object[key.downcase] = hash_to_object(value)
|
110
|
-
end
|
111
|
-
OpenStruct.new(object)
|
112
|
-
when Array
|
113
|
-
object = object.clone
|
114
|
-
object.map! { |i| hash_to_object(i) }
|
115
|
-
else
|
116
|
-
object
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
data/lib/hominid/helper.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
module Hominid
|
2
|
-
module Helper
|
3
|
-
|
4
|
-
# Retrieve lots of account information including payments made, plan info,
|
5
|
-
# some account stats, installed modules, contact info, and more. No private
|
6
|
-
# information like Credit Card numbers is available.
|
7
|
-
#
|
8
|
-
# Parameters:
|
9
|
-
# * none
|
10
|
-
#
|
11
|
-
# Returns:
|
12
|
-
# An array of account details for this API key including:
|
13
|
-
# * username (String) = The Account username.
|
14
|
-
# * user_id (String) = The Account user unique id (for building some links).
|
15
|
-
# * is_trial (Boolean) = Whether the Account is in Trial mode.
|
16
|
-
# * timezone (String) = The timezone for the Account.
|
17
|
-
# * plan_type (String) = Plan Type - "monthly", "payasyougo", or "free".
|
18
|
-
# * plan_low (Integer) = Only for Monthly plans - the lower tier for list size.
|
19
|
-
# * plan_high (Integer) = Only for Monthly plans - the upper tier for list size.
|
20
|
-
# * plan_start_date (DateTime) = Only for Monthly plans - the start date for a monthly plan.
|
21
|
-
# * emails_left (Integer) = Only for Free and Pay-as-you-go plans emails credits left for the account.
|
22
|
-
# * pending_monthly (Boolean) = Whether the account is finishing Pay As You Go credits before switching to a Monthly plan.
|
23
|
-
# * first_payment (DateTime) = Date of first payment.
|
24
|
-
# * last_payment (DateTime) = Date of most recent payment.
|
25
|
-
# * times_logged_in (Integer) = Total number of times the account has been logged into via the web.
|
26
|
-
# * last_login (DateTime) = Date/time of last login via the web.
|
27
|
-
# * affiliate_link (String) = Monkey Rewards link for our Affiliate program.
|
28
|
-
# * contact (Array) = Contact details for the account, including: First & Last name, email, company name, address, phone, and url.
|
29
|
-
# * addons (Array) = Addons installed in the account and the date they were installed.
|
30
|
-
# * orders (Array) = Order details for the account, include order_id, type, cost, date/time, and any credits applied to the order.
|
31
|
-
#
|
32
|
-
def account_details
|
33
|
-
hash_to_object(call("getAccountDetails"))
|
34
|
-
end
|
35
|
-
|
36
|
-
# Get the current Chimp Chatter messages for an account.
|
37
|
-
#
|
38
|
-
# Returns:
|
39
|
-
# The current Chimp Chatter for an account.
|
40
|
-
#
|
41
|
-
def chatter
|
42
|
-
call("chimpChatter")
|
43
|
-
end
|
44
|
-
|
45
|
-
# Create a new folder to file campaigns in.
|
46
|
-
#
|
47
|
-
# Parameters:
|
48
|
-
# * name (String) = A unique name for a folder.
|
49
|
-
#
|
50
|
-
# Returns:
|
51
|
-
# The folder_id of the newly created folder. (Integer)
|
52
|
-
#
|
53
|
-
def create_folder(name)
|
54
|
-
call("createFolder", name)
|
55
|
-
end
|
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
|
-
|
88
|
-
# Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content,
|
89
|
-
# an existing Campaign Id, or an existing Template Id. Note that this will not save anything to or update any of
|
90
|
-
# your lists, campaigns, or templates.
|
91
|
-
#
|
92
|
-
# Parameters:
|
93
|
-
# * type (String) = Must be one of: "html", "template", "url", "cid", or "tid".
|
94
|
-
# * content (String) = The content to use. For "html" expects a single string value, "template" expects an array like you send to campaignCreate, "url" expects a valid & public URL to pull from, "cid" expects a valid Campaign Id, and "tid" expects a valid Template Id on your account.
|
95
|
-
#
|
96
|
-
# Returns:
|
97
|
-
# The content passed in converted to text. (String)
|
98
|
-
#
|
99
|
-
def generate_text(type, content)
|
100
|
-
call("generateText", type, content)
|
101
|
-
end
|
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
|
-
|
117
|
-
# "Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything
|
118
|
-
# is good. Note than unlike most all of our methods, we don't throw an Exception if we are having issues. You will
|
119
|
-
# simply receive a different string back that will explain our view on what is going on.
|
120
|
-
#
|
121
|
-
# Returns:
|
122
|
-
# "Everything's Chimpy!"
|
123
|
-
#
|
124
|
-
def ping()
|
125
|
-
call("ping")
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
end
|