hominid 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  pkg/*
3
3
  pkg/*.*
4
4
  .svn
5
+ rdoc
@@ -0,0 +1,118 @@
1
+ = Hominid
2
+
3
+ Hominid is a Ruby gem that provides a wrapper for interacting with the Mailchimp[http://eepurl.com/ew8J] email marketing service API ({version 1.2}[http://www.mailchimp.com/api/1.2/]).
4
+
5
+ == Installation
6
+
7
+ sudo gem install hominid
8
+
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
+
11
+ sudo gem install gemcutter
12
+
13
+ == Requirements
14
+
15
+ You will need a Mailchimp[http://eepurl.com/ew8J] account. Once you have your Mailchimp account set up, you will need to {generate an API key}[http://admin.mailchimp.com/account/api/] in order to get started using Hominid.
16
+
17
+ == Usage
18
+
19
+ Hominid is intended to be a complete Ruby wrapper for working with the Mailchimp API. As of release 2.0.2, all methods available from the Mailchimp API (Version 1.2) are available. Please note in order to use some methods you will need to have {A.I.M. Reports}[https://admin.mailchimp.com/account/addons] installed on your Mailchimp account.
20
+
21
+ You will need to pass your Mailchimp API key to get started:
22
+
23
+ h = Hominid::Base.new({:api_key => API_KEY})
24
+
25
+ You can also pass in any other config options that you would like to change from the defaults. Take a look at Hominid::Base to see what the default values are.
26
+
27
+ Once you have created a Hominid object, you can begin interacting with the Mailchimp account that your API key is associated with.
28
+
29
+ === Working with Lists
30
+
31
+ We have provided some finder methods to make working with your mailing lists easier:
32
+
33
+ lists = h.lists
34
+ list = h.find_list_by_name("Mailing List Name")
35
+ list = h.find_list_by_id("List ID")
36
+ list = h.find_list_by_web_id("List Web ID")</code></pre>
37
+
38
+ There are also finders for easily getting at List ID's, which are required for nearly all the list methods:
39
+
40
+ list_id = h.find_list_id_by_name("Mailing List Name")
41
+ list_id_ = h.find_list_id_by_web_id("List Web ID")
42
+
43
+ This means that you can _(for example)_ subscribe someone to a particular mailing list:
44
+
45
+ h.subscribe(h.find_list_id_by_name("Mailing List Name"), "email@domain.com", {:FNAME => "Bob", :LNAME => "Smith"}, {:email_type => 'html'})
46
+
47
+ Or to update a subscriber to a particular list:
48
+
49
+ h.update_member(h.find_list_id_by_name("Mailing List Name"), "old_email@domain.com", {:EMAIL => "new_email_@domain.com"}, 'html')
50
+
51
+ Take a look at Hominid::List to see the methods that are available for interacting with your lists.
52
+
53
+ === Working with Campaigns
54
+
55
+ We have provided some finder methods to make working with your campaigns easier:
56
+
57
+ campaigns = h.campaigns
58
+ campaigns = h.find_campaigns_by_list_name("Mailing List Name")
59
+ campaigns = h.find_campaigns_by_list_id("Mailing List ID")
60
+ campaigns = h.find_campaigns_by_type("regular")
61
+ campaign = h.find_campaign_by_id("Campaign ID")
62
+ campaign = h.find_campaign_by_title("Campaign Title")
63
+
64
+ To create a new campaign, use the +create_campaign+ method:
65
+
66
+ new_campaign = h.create_campaign(...)
67
+
68
+ Take a look at Hominid::Campaign to see the methods that are available for interacting with your campaigns.
69
+
70
+ === Mailchimp Helper Methods
71
+
72
+ There are a series of helper methods that are also made available with the Hominid gem. For example, to retrieve information about the Mailchimp account associated with your API key, simply:
73
+
74
+ account_details_ = h.account_details
75
+
76
+ In this case, the +account_details+ object can be accessed like:
77
+
78
+ account_details.contact.company
79
+ account_details.orders
80
+
81
+ Take a look at Hominid::Helper to see the helper methods that are available.
82
+
83
+ === Mailchimp Security Methods
84
+
85
+ There are a couple of security methods that are also made available with the Hominid gem. These are primarily used for dealing with API keys, and require your Mailchimp account username and password:
86
+
87
+ h.api_keys('username', 'password')
88
+
89
+ Take a look at Hominid::Security to see the security methods that are available.
90
+
91
+ == Contributors
92
+
93
+ Hominid is maintained by {Brian Getting}[http://terra-firma-design.com]. A very special thank-you to {Michael Strüder}[http://github.com/mikezter] for all of his hard work. Also, Hominid wouldn't be anywhere near as awesome as it is today without fantastic contributions and inspiration from:
94
+
95
+ * {Alan Harper}[http://github.com/aussiegeek]
96
+ * {Will}[http://github.com/willinfront]
97
+ * {Ben Woosley}[http://github.com/Empact]
98
+ * {banker}[http://github.com/banker]
99
+ * {Kristoffer Renholm}[http://github.com/renholm]
100
+ * {Wiktor Schmidt}[http://github.com/netguru]
101
+ * {ron}[http://github.com/ron]
102
+ * {Matthew Carlson}[http://mandarinsoda.com/]
103
+ * {Kelly Mahan}[http://digimedia.com/]
104
+ * {C.G. Brown}[http://www.projectlocker.com/]
105
+ * {Bill Abney}[http://github.com/babney]
106
+ * {David Rice}[http://github.com/davidjrice]
107
+
108
+ == Note on Patches/Pull Requests
109
+
110
+ 1. Fork the project.
111
+ 2. Make your feature addition or bug fix.
112
+ 3. Add tests for it. This is important so I don't break it in a future version unintentionally.
113
+ 4. Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
114
+ 5. Send me a pull request. Bonus points for topic branches.
115
+
116
+ == Copyright
117
+
118
+ Copyright (c) 2009 Brian Getting. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
@@ -5,21 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hominid}
8
- s.version = "2.0.2"
8
+ s.version = "2.0.3"
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-17}
12
+ s.date = %q{2010-02-06}
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 = [
16
16
  "LICENSE",
17
- "README.textile"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".gitignore",
21
21
  "LICENSE",
22
- "README.textile",
22
+ "README.rdoc",
23
23
  "Rakefile",
24
24
  "VERSION",
25
25
  "hominid.gemspec",
@@ -29,15 +29,11 @@ module Hominid
29
29
  end
30
30
  end
31
31
 
32
- # --------------------------------
33
- # Used internally by Hominid
34
- # --------------------------------
35
-
36
- def apply_defaults_to(options)
32
+ def apply_defaults_to(options) # :nodoc:
37
33
  @config.merge(options)
38
34
  end
39
35
 
40
- def call(method, *args)
36
+ def call(method, *args) # :nodoc:
41
37
  @chimpApi.call(method, @config[:api_key], *args)
42
38
  rescue XMLRPC::FaultException => error
43
39
  # Handle common cases for which the Mailchimp API would raise Exceptions
@@ -65,7 +61,7 @@ module Hominid
65
61
  raise CommunicationError.new(error.message)
66
62
  end
67
63
 
68
- def clean_merge_tags(merge_tags)
64
+ def clean_merge_tags(merge_tags) # :nodoc:
69
65
  return {} unless merge_tags.is_a? Hash
70
66
  merge_tags.each do |key, value|
71
67
  if merge_tags[key].is_a? String
@@ -76,7 +72,7 @@ module Hominid
76
72
  end
77
73
  end
78
74
 
79
- def hash_to_object(object)
75
+ def hash_to_object(object) # :nodoc:
80
76
  return case object
81
77
  when Hash
82
78
  object = object.clone
@@ -1,660 +1,645 @@
1
1
  module Hominid
2
2
  module Campaign
3
3
 
4
- # CAMPAIGN RELATED METHODS
5
-
4
+ # Get all the campaigns for this account.
5
+ #
6
+ # Parameters:
7
+ # * filters (Hash) = A hash of filters to apply to query. See the Mailchimp API documentation for more info.
8
+ # * start (Integer) = Control paging of results.
9
+ # * limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
10
+ #
11
+ # Returns:
12
+ # An array of campaigns.
13
+ #
6
14
  def campaigns(filters = {}, start = 0, limit = 25)
7
- # Get all the campaigns for this account.
8
- #
9
- # Parameters:
10
- # filters (Hash) = A hash of filters to apply to query. See the Mailchimp API documentation for more info.
11
- # start (Integer) = Control paging of results.
12
- # limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
13
- #
14
- # Returns:
15
- # An array of campaigns.
16
- #
17
15
  call("campaigns", filters, start, limit)
18
16
  end
19
-
17
+
18
+ # Find a campaign by id
19
+ #
20
+ # Parameters:
21
+ # * campaign_id (String) = The unique ID of the campaign to return.
22
+ #
23
+ # Returns:
24
+ # A single campaign.
25
+ #
20
26
  def find_campaign_by_id(campaign_id)
21
- # Find a campaign by id
22
- #
23
- # Parameters:
24
- # campaign_id (String) = The unique ID of the campaign to return.
25
- #
26
- # Returns:
27
- # A single campaign.
28
- #
29
27
  call("campaigns", {:campaign_id => campaign_id}).first
30
28
  end
31
29
 
30
+ # Find a campaign by web_id
31
+ #
32
+ # Parameters:
33
+ # * campaign_web_id (Integer) = The unique ID of the campaign to return.
34
+ #
35
+ # Returns:
36
+ # A single campaign.
37
+ #
32
38
  def find_campaign_by_web_id(campaign_web_id)
33
- # Find a campaign by web_id
34
- #
35
- # Parameters:
36
- # campaign_web_id (Integer) = The unique ID of the campaign to return.
37
- #
38
- # Returns:
39
- # A single campaign.
40
- #
41
39
  call("campaigns").find {|campaign| campaign["web_id"] == campaign_web_id}
42
40
  end
43
-
41
+
42
+ # Find a campaign by name
43
+ #
44
+ # Parameters:
45
+ # * title (String) = The title of the campaign to return.
46
+ #
47
+ # Returns:
48
+ # An array of campaigns.
49
+ #
44
50
  def find_campaigns_by_title(title)
45
- # Find a campaign by name
46
- #
47
- # Parameters:
48
- # title (String) = The title of the campaign to return.
49
- #
50
- # Returns:
51
- # An array of campaigns.
52
- #
53
51
  call("campaigns", {:title => title})
54
52
  end
55
-
53
+
54
+ # Find campaigns by list name
55
+ #
56
+ # Parameters:
57
+ # * list_name (String) = The name of the mailing list to return campaigns for.
58
+ # * start (Integer) = Control paging of results.
59
+ # * limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
60
+ #
61
+ # Returns:
62
+ # An array of campaigns.
63
+ #
56
64
  def find_campaigns_by_list_name(list_name, start = 0, limit = 25)
57
- # Find campaigns by list name
58
- #
59
- # Parameters:
60
- # list_name (String) = The name of the mailing list to return campaigns for.
61
- # start (Integer) = Control paging of results.
62
- # limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
63
- #
64
- # Returns:
65
- # An array of campaigns.
66
- #
67
65
  call("campaigns", {:list_id => find_list_id_by_name(list_name)}, start, limit)
68
66
  end
69
-
67
+
68
+ # Find campaigns by list id
69
+ #
70
+ # Parameters:
71
+ # * list_id (String) = The ID of the mailing list to return campaigns for.
72
+ # * start (Integer) = Control paging of results.
73
+ # * limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
74
+ #
75
+ # Returns:
76
+ # An array of campaigns.
77
+ #
70
78
  def find_campaigns_by_list_id(list_id, start = 0, limit = 25)
71
- # Find campaigns by list id
72
- #
73
- # Parameters:
74
- # list_id (String) = The ID of the mailing list to return campaigns for.
75
- # start (Integer) = Control paging of results.
76
- # limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
77
- #
78
- # Returns:
79
- # An array of campaigns.
80
- #
81
79
  call("campaigns", {:list_id => list_id}, start, limit)
82
80
  end
83
-
81
+
82
+ # Find campaigns by type
83
+ #
84
+ # Parameters:
85
+ # * type (String) = One of: 'regular', 'plaintext', 'absplit', 'rss', 'inspection', 'trans', 'auto'
86
+ # * start (Integer) = Control paging of results.
87
+ # * limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
88
+ #
89
+ # Returns:
90
+ # An array of campaigns.
91
+ #
84
92
  def find_campaigns_by_type(type, start = 0, limit = 25)
85
- # Find campaigns by type
86
- #
87
- # Parameters:
88
- # type (String) = One of: 'regular', 'plaintext', 'absplit', 'rss', 'inspection', 'trans', 'auto'
89
- # start (Integer) = Control paging of results.
90
- # limit (Integer) = Number of campaigns to return. Upper limit set at 1000.
91
- #
92
- # Returns:
93
- # An array of campaigns.
94
- #
95
93
  call("campaigns", {:type => type}, start, limit)
96
94
  end
97
95
 
98
- def create_campaign(type = 'regular', options = {}, content = {}, segment_options = {}, type_opts = {})
99
- # Create a new draft campaign to send.
100
- #
101
- # Parameters:
102
- # type (String) = One of "regular", "plaintext", "absplit", "rss", "trans" or "auto".
103
- # options (Hash) = A hash of options for creating this campaign including:
104
- # :list_id = (String) The ID of the list to send this campaign to.
105
- # :subject = (String) The subject of the campaign.
106
- # :from_email = (String) The email address this campaign will come from.
107
- # :from_name = (String) The name that this campaign will come from.
108
- # :to_email = (String) The To: name recipients will see.
109
- # :template_id = (Integer) The ID of the template to use for this campaign (optional).
110
- # :folder_id = (Integer) The ID of the folder to file this campaign in (optional).
111
- # :tracking = (Array) What to track for this campaign (optional).
112
- # :title = (String) Internal title for this campaign (optional).
113
- # :authenticate = (Boolean) Set to true to authenticate campaign (optional).
114
- # :analytics = (Array) Google analytics tags (optional).
115
- # :auto_footer = (Boolean) Auto-generate the footer (optional)?
116
- # :inline_css = (Boolean) Inline the CSS styles (optional)?
117
- # :generate_text = (Boolean) Auto-generate text from HTML email (optional)?
118
- # content (Hash) = The content for this campaign - use a struct with the following keys:
119
- # :html (String) = The HTML content of the campaign.
120
- # :text (String) = The text content of the campaign.
121
- # :url (String) = A URL to pull content from. This will override other content settings.
122
- # :archive (String) = To send a Base64 encoded archive file for Mailchimp to import all media from.
123
- # :archive_type (String) = Only necessary for the "archive" option. Supported formats are: zip, tar.gz,
124
- # tar.bz2, tar, tgz, tbz. Defaults to zip. (optional)
125
- # segment_options (Hash) = Segmentation options. See the Mailchimp API documentation for more information.
126
- # type_opts (Hash) = An array of options for this campaign type. See the Mailchimp API documentation for
127
- # for more information.
128
- #
129
- # Returns:
130
- # The ID for the created campaign. (String)
131
- #
132
- call("campaignCreate", type, options, content, segment_options, type_opts)
96
+ # Create a new draft campaign to send.
97
+ #
98
+ # Parameters:
99
+ # * options (Hash) = A hash of options for creating this campaign including:
100
+ # * :list_id = (String) The ID of the list to send this campaign to.
101
+ # * :subject = (String) The subject of the campaign.
102
+ # * :from_email = (String) The email address this campaign will come from.
103
+ # * :from_name = (String) The name that this campaign will come from.
104
+ # * :to_email = (String) The To: name recipients will see.
105
+ # * :template_id = (Integer) The ID of the template to use for this campaign (optional).
106
+ # * :folder_id = (Integer) The ID of the folder to file this campaign in (optional).
107
+ # * :tracking = (Array) What to track for this campaign (optional).
108
+ # * :title = (String) Internal title for this campaign (optional).
109
+ # * :authenticate = (Boolean) Set to true to authenticate campaign (optional).
110
+ # * :analytics = (Array) Google analytics tags (optional).
111
+ # * :auto_footer = (Boolean) Auto-generate the footer (optional)?
112
+ # * :inline_css = (Boolean) Inline the CSS styles (optional)?
113
+ # * :generate_text = (Boolean) Auto-generate text from HTML email (optional)?
114
+ # * content (Hash) = The content for this campaign - use a struct with the following keys:
115
+ # * :html (String) = The HTML content of the campaign.
116
+ # * :text (String) = The text content of the campaign.
117
+ # * :url (String) = A URL to pull content from. This will override other content settings.
118
+ # * :archive (String) = To send a Base64 encoded archive file for Mailchimp to import all media from.
119
+ # * :archive_type (String) = Only necessary for the "archive" option. Supported formats are: zip, tar.gz, tar.bz2, tar, tgz, tbz. Defaults to zip. (optional)
120
+ # * segment_options (Hash) = Segmentation options. See the Mailchimp API documentation for more information.
121
+ # * type (String) = One of "regular", "plaintext", "absplit", "rss", "trans" or "auto".
122
+ # * type_opts (Hash) = An array of options for this campaign type. See the Mailchimp API documentation for for more information.
123
+ #
124
+ # Returns:
125
+ # The ID for the created campaign. (String)
126
+ #
127
+ def create_campaign(options = {}, content = {}, campaign_type = 'regular', segment_options = {}, type_opts = {})
128
+ call("campaignCreate", campaign_type, options, content, segment_options, type_opts)
133
129
  # TODO: Should we return the new campaign instead of the ID returned from the API?
134
130
  end
135
-
131
+
132
+ # List all the folders for a user account.
133
+ #
134
+ # Returns:
135
+ # An array of templates for this campaign including:
136
+ # * folder_id (Integer) = Folder Id for the given folder, this can be used in the campaigns() function to filter on.
137
+ # * name (String) = Name of the given folder.
138
+ #
136
139
  def folders
137
- # List all the folders for a user account.
138
- #
139
- # Returns:
140
- # An array of templates for this campaign including:
141
- # folder_id (Integer) = Folder Id for the given folder, this can be used in the campaigns() function to filter on.
142
- # name (String) = Name of the given folder.
143
- #
144
140
  call("campaignFolders")
145
141
  end
146
-
142
+
143
+ # Retrieve all templates defined for your user account.
144
+ #
145
+ # Returns:
146
+ # An array of templates for this campaign including:
147
+ # * id (Integer) = The ID of the template.
148
+ # * name (String) = The name of the template.
149
+ # * layout (String) = The layout of the template - "basic", "left_column", "right_column", or "postcard".
150
+ # * sections (Array) = An associative array of editable sections in the template that can accept custom HTML when sending a campaign.
151
+ #
147
152
  def templates
148
- # Retrieve all templates defined for your user account.
149
- #
150
- # Returns:
151
- # An array of templates for this campaign including:
152
- # id (Integer) = The ID of the template.
153
- # name (String) = The name of the template.
154
- # layout (String) = The layout of the template - "basic", "left_column", "right_column", or "postcard".
155
- # sections (Array) = An associative array of editable sections in the template that can accept custom HTML
156
- # when sending a campaign.
157
- #
158
153
  call("campaignTemplates")
159
154
  end
160
-
161
- def campaign_abuse_reports(campaign_id, start = 0, limit = 500, since = "2000-01-01 00:00:00")
162
- # Get all email addresses that complained about a given campaign.
163
- #
164
- # Parameters:
165
- # campaign_id (String) = The ID of the campaign.
166
- # start (Integer) = Page number to start at. Defaults to 0.
167
- # limit (Integer) = Number of results to return. Defaults to 500. Upper limit is 1000.
168
- # since (DateTime) = Only return email reports since this date. Must be in YYYY-MM-DD HH:II:SS format (GMT).
169
- #
170
- # Returns:
171
- # An array of abuse reports for this list in the format:
172
- #
155
+
156
+ # Get all email addresses that complained about a given campaign.
157
+ #
158
+ # Parameters:
159
+ # * campaign_id (String) = The ID of the campaign.
160
+ # * start (Integer) = Page number to start at. Defaults to 0.
161
+ # * limit (Integer) = Number of results to return. Defaults to 500. Upper limit is 1000.
162
+ # * since (DateTime) = Only return email reports since this date. Must be in YYYY-MM-DD HH:II:SS format (GMT).
163
+ #
164
+ # Returns:
165
+ # An array of abuse reports for this list in the format:
166
+ #
167
+ def campaign_abuse_reports(campaign_id, start = 0, limit = 500, since = "2000-01-01 00:00:00")
173
168
  call("campaignAbuseReports", campaign_id, start, limit, since)
174
169
  end
175
170
 
171
+ # Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
172
+ # suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary.
173
+ #
174
+ # Parameters:
175
+ # * campaign_id (String) = The ID of the campaign.
176
+ #
177
+ # Returns:
178
+ # An array of advice on the campaign's performance including:
179
+ # * msg (String) = Advice message.
180
+ # * type (String) = One of: negative, positive, or neutral.
181
+ #
176
182
  def advice(campaign_id)
177
- # Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best
178
- # suited for display in customized reports pages. Note: some messages will contain HTML - clean tags as necessary.
179
- #
180
- # Parameters:
181
- # campaign_id (String) = The ID of the campaign.
182
- #
183
- # Returns:
184
- # An array of advice on the campaign's performance including:
185
- # msg (String) = Advice message.
186
- # type (String) = One of: negative, positive, or neutral.
187
- #
188
183
  call("campaignAdvice", campaign_id)
189
184
  end
190
185
 
186
+ # Attach Ecommerce Order Information to a Campaign.
187
+ #
188
+ # Parameters:
189
+ # * campaign_id (String) = The ID of the campaign.
190
+ # * order (Hash) = A hash of order information including:
191
+ # * id (String) = The order id
192
+ # * email_id (String) = Email id of the subscriber (mc_eid query string)
193
+ # * total (Double) = Show only campaigns with this from_name.
194
+ # * shipping (String) = The total paid for shipping fees. (optional)
195
+ # * tax (String) = The total tax paid. (optional)
196
+ # * store_id (String) = A unique id for the store sending the order in
197
+ # * store_name (String) = A readable name for the store, typicaly the hostname. (optional)
198
+ # * plugin_id (String) = The MailChimp-assigned Plugin Id. Using 1214 for the moment.
199
+ # * items (Array) = The individual line items for an order, using the following keys:
200
+ # * line_num (Integer) = The line number of the item on the order. (optional)
201
+ # * product_id (Integer) = Internal product id.
202
+ # * product_name (String) = The name for the product_id associated with the item.
203
+ # * category_id (Integer) = Internal id for the (main) category associated with product.
204
+ # * category_name (String) = The category name for the category id.
205
+ # * qty (Double) = The quantity of items ordered.
206
+ # * cost (Double) = The cost of a single item (Ex. Not the extended cost of the line).
207
+ #
208
+ # Returns:
209
+ # True if successful, error code if not.
210
+ #
191
211
  def add_order(campaign_id, order)
192
- # Attach Ecommerce Order Information to a Campaign.
193
- #
194
- # Parameters:
195
- # campaign_id (String) = The ID of the campaign.
196
- # order (Hash) = A hash of order information including:
197
- # id (String) = The order id
198
- # email_id (String) = Email id of the subscriber (mc_eid query string)
199
- # total (Double) = Show only campaigns with this from_name.
200
- # shipping (String) = The total paid for shipping fees. (optional)
201
- # tax (String) = The total tax paid. (optional)
202
- # store_id (String) = A unique id for the store sending the order in
203
- # store_name (String) = A readable name for the store, typicaly the hostname. (optional)
204
- # plugin_id (String) = The MailChimp-assigned Plugin Id. Using 1214 for the moment.
205
- # items (Array) = The individual line items for an order, using the following keys:
206
- # line_num (Integer) = The line number of the item on the order. (optional)
207
- # product_id (Integer) = Internal product id.
208
- # product_name (String) = The name for the product_id associated with the item.
209
- # category_id (Integer) = Internal id for the (main) category associated with product.
210
- # category_name (String) = The category name for the category id.
211
- # qty (Double) = The quantity of items ordered.
212
- # cost (Double) = The cost of a single item (Ex. Not the extended cost of the line).
213
- #
214
- # Returns:
215
- # True if successful, error code if not.
216
- #
217
212
  order = order.merge(:campaign_id => campaign_id)
218
213
  call("campaignEcommAddOrder", order)
219
214
  end
220
215
  alias :ecomm_add_order :add_order
221
216
 
217
+ # Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google
218
+ # Analytics Add-on to be installed and configured.
219
+ #
220
+ # Parameters:
221
+ # * campaign_id (String) = The ID of the campaign.
222
+ #
223
+ # Returns:
224
+ # An array of analytics for the passed campaign including:
225
+ # * visits (Integer) = Number of visits.
226
+ # * pages (Integer) = Number of page views.
227
+ # * new_visits (Integer) = New visits recorded.
228
+ # * bounces (Integer) = Vistors who "bounced" from your site.
229
+ # * time_on_site (Double) =
230
+ # * goal_conversions (Integer) = Number of goals converted.
231
+ # * goal_value (Double) = Value of conversion in dollars.
232
+ # * revenue (Double) = Revenue generated by campaign.
233
+ # * transactions (Integer) = Number of transactions tracked.
234
+ # * ecomm_conversions (Integer) = Number Ecommerce transactions tracked.
235
+ # * goals (Array) = An array containing goal names and number of conversions.
236
+ #
222
237
  def analytics(campaign_id)
223
- # Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google
224
- # Analytics Add-on to be installed and configured.
225
- #
226
- # Parameters:
227
- # campaign_id (String) = The ID of the campaign.
228
- #
229
- # Returns:
230
- # An array of analytics for the passed campaign including:
231
- # visits (Integer) = Number of visits.
232
- # pages (Integer) = Number of page views.
233
- # new_visits (Integer) = New visits recorded.
234
- # bounces (Integer) = Vistors who "bounced" from your site.
235
- # time_on_site (Double) =
236
- # goal_conversions (Integer) = Number of goals converted.
237
- # goal_value (Double) = Value of conversion in dollars.
238
- # revenue (Double) = Revenue generated by campaign.
239
- # transactions (Integer) = Number of transactions tracked.
240
- # ecomm_conversions (Integer) = Number Ecommerce transactions tracked.
241
- # goals (Array) = An array containing goal names and number of conversions.
242
- #
243
238
  call("campaignAnalytics", campaign_id)
244
239
  end
245
240
 
241
+ # Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts
242
+ # of data depending on how large the campaign was and how much cruft the bounce provider returned. Also,
243
+ # messages over 30 days old are subject to being removed.
244
+ #
245
+ # Parameters:
246
+ # * campaign_id (String) = The ID of the campaign.
247
+ # * start (Integer) = For large data sets, the page number to start at.
248
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 50.
249
+ # * since (Date) = Pull only messages since this time - use YYYY-MM-DD format in GMT.
250
+ #
251
+ # Returns:
252
+ # An array of full bounce messages for this campaign including:
253
+ # * date (String) = Date/time the bounce was received and processed.
254
+ # * email (String) = The email address that bounced.
255
+ # * message (String) = The entire bounce message received.
256
+ #
246
257
  def bounce_messages(campaign_id, start = 0, limit = 25, since = "2000-01-01")
247
- # Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts
248
- # of data depending on how large the campaign was and how much cruft the bounce provider returned. Also,
249
- # messages over 30 days old are subject to being removed.
250
- #
251
- # Parameters:
252
- # campaign_id (String) = The ID of the campaign.
253
- # start (Integer) = For large data sets, the page number to start at.
254
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 50.
255
- # since (Date) = Pull only messages since this time - use YYYY-MM-DD format in GMT.
256
- #
257
- # Returns:
258
- # An array of full bounce messages for this campaign including:
259
- # date (String) = Date/time the bounce was received and processed.
260
- # email (String) = The email address that bounced.
261
- # message (String) = The entire bounce message received.
262
- #
263
258
  call("campaignBounceMessages", campaign_id, start, limit, since)
264
259
  end
265
260
 
261
+ # Return the list of email addresses that clicked on a given url, and how many times they clicked.
262
+ # Note: Requires the AIM module to be installed.
263
+ #
264
+ # Parameters:
265
+ # * campaign_id (String) = The ID of the campaign.
266
+ # * url (String) = The URL of the link that was clicked on.
267
+ # * start (Integer) = For large data sets, the page number to start at.
268
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
269
+ #
270
+ # Returns:
271
+ # An array of structs containing email addresses and click counts including:
272
+ # * email (String) = Email address that opened the campaign.
273
+ # * clicks (Integer) = Total number of times the URL was clicked on by this email address.
274
+ #
266
275
  def click_details(campaign_id, url, start = 0, limit = 1000)
267
- # Return the list of email addresses that clicked on a given url, and how many times they clicked.
268
- # Note: Requires the AIM module to be installed.
269
- #
270
- # Parameters:
271
- # campaign_id (String) = The ID of the campaign.
272
- # url (String) = The URL of the link that was clicked on.
273
- # start (Integer) = For large data sets, the page number to start at.
274
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
275
- #
276
- # Returns:
277
- # An array of structs containing email addresses and click counts including:
278
- # email (String) = Email address that opened the campaign.
279
- # clicks (Integer) = Total number of times the URL was clicked on by this email address.
280
- #
281
276
  call("campaignClickDetailAIM", campaign_id, url, start, limit)
282
277
  end
283
278
  alias :click_detail_aim :click_details
284
279
 
280
+ # Get an array of the urls being tracked, and their click counts for a given campaign.
281
+ #
282
+ # Parameters:
283
+ # * campaign_id (String) = The ID of the campaign.
284
+ #
285
+ # Returns:
286
+ # A struct of URLs and associated statistics including:
287
+ # * clicks (Integer) = Number of times the specific link was clicked.
288
+ # * unique (Integer) = Number of unique people who clicked on the specific link.
289
+ #
285
290
  def click_stats(campaign_id)
286
- # Get an array of the urls being tracked, and their click counts for a given campaign.
287
- #
288
- # Parameters:
289
- # campaign_id (String) = The ID of the campaign.
290
- #
291
- # Returns:
292
- # A struct of URLs and associated statistics including:
293
- # clicks (Integer) = Number of times the specific link was clicked.
294
- # unique (Integer) = Number of unique people who clicked on the specific link.
295
- #
296
291
  call("campaignClickStats", campaign_id)
297
292
  end
298
293
 
294
+ # Get the content (both html and text) for a campaign either as it would appear in the campaign archive
295
+ # or as the raw, original content.
296
+ #
297
+ # Parameters:
298
+ # * campaign_id (String) = The ID of the campaign.
299
+ # * for_archive (Boolean) = Controls whether we return the Archive version (true) or the Raw version (false), defaults to true.
300
+ #
301
+ # Returns:
302
+ # A struct containing all content for the campaign including:
303
+ # * html (String) = The HTML content used for the campgain with merge tags intact.
304
+ # * text (String) = The Text content used for the campgain with merge tags intact.
305
+ #
299
306
  def content(campaign_id, for_archive = true)
300
- # Get the content (both html and text) for a campaign either as it would appear in the campaign archive
301
- # or as the raw, original content.
302
- #
303
- # Parameters:
304
- # campaign_id (String) = The ID of the campaign.
305
- # for_archive (Boolean) = Controls whether we return the Archive version (true) or the Raw version (false),
306
- # defaults to true.
307
- #
308
- # Returns:
309
- # A struct containing all content for the campaign including:
310
- # html (String) = The HTML content used for the campgain with merge tags intact.
311
- # text (String) = The Text content used for the campgain with merge tags intact.
312
- #
313
307
  call("campaignContent", campaign_id, for_archive)
314
308
  end
315
309
  alias :campaign_content :content
316
310
 
311
+ # Delete a campaign.
312
+ #
313
+ # Parameters:
314
+ # * campaign_id (String) = The ID of the campaign.
315
+ #
316
+ # Returns:
317
+ # True if successful, error code if not.
318
+ #
317
319
  def delete(campaign_id)
318
- # Delete a campaign.
319
- #
320
- # Parameters:
321
- # campaign_id (String) = The ID of the campaign.
322
- #
323
- # Returns:
324
- # True if successful, error code if not.
325
- #
326
320
  call("campaignDelete", campaign_id)
327
321
  end
328
322
  alias :delete_campaign :delete
329
323
 
324
+ # Get the top 5 performing email domains for this campaign.
325
+ #
326
+ # Parameters:
327
+ # * campaign_id (String) = The ID of the campaign.
328
+ #
329
+ # Returns:
330
+ # An array of email domains and their associated stats including:
331
+ # * domain (String) = Domain name or special "Other" to roll-up stats past 5 domains.
332
+ # * total_sent (Integer) = Total Email across all domains - this will be the same in every row.
333
+ # * emails (Integer) = Number of emails sent to this domain.
334
+ # * bounces (Integer) = Number of bounces.
335
+ # * opens (Integer) = Number of opens.
336
+ # * clicks (Integer) = Number of clicks.
337
+ # * unsubs (Integer) = Number of unsubscribes.
338
+ # * delivered (Integer) = Number of deliveries.
339
+ # * emails_pct (Integer) = Percentage of emails that went to this domain (whole number).
340
+ # * bounces_pct (Integer) = Percentage of bounces from this domain (whole number).
341
+ # * opens_pct (Integer) = Percentage of opens from this domain (whole number).
342
+ # * clicks_pct (Integer) = Percentage of clicks from this domain (whole number).
343
+ # * unsubs_pct (Integer) = Percentage of unsubs from this domain (whole number).
344
+ #
330
345
  def email_domain_performance(campaign_id)
331
- # Get the top 5 performing email domains for this campaign.
332
- #
333
- # Parameters:
334
- # campaign_id (String) = The ID of the campaign.
335
- #
336
- # Returns:
337
- # An array of email domains and their associated stats including:
338
- # domain (String) = Domain name or special "Other" to roll-up stats past 5 domains.
339
- # total_sent (Integer) = Total Email across all domains - this will be the same in every row.
340
- # emails (Integer) = Number of emails sent to this domain.
341
- # bounces (Integer) = Number of bounces.
342
- # opens (Integer) = Number of opens.
343
- # clicks (Integer) = Number of clicks.
344
- # unsubs (Integer) = Number of unsubscribes.
345
- # delivered (Integer) = Number of deliveries.
346
- # emails_pct (Integer) = Percentage of emails that went to this domain (whole number).
347
- # bounces_pct (Integer) = Percentage of bounces from this domain (whole number).
348
- # opens_pct (Integer) = Percentage of opens from this domain (whole number).
349
- # clicks_pct (Integer) = Percentage of clicks from this domain (whole number).
350
- # unsubs_pct (Integer) = Percentage of unsubs from this domain (whole number).
351
- #
352
346
  call("campaignEmailDomainPerformance", campaign_id)
353
347
  end
354
348
  alias :email_performance :email_domain_performance
355
349
 
350
+ # Given a campaign and email address, return the entire click and open history with timestamps, ordered by time.
351
+ # Note: Requires the AIM module to be installed.
352
+ #
353
+ # Parameters:
354
+ # * campaign_id (String) = The ID of the campaign.
355
+ # * email (String) = The email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns.
356
+ #
357
+ # Returns:
358
+ # An array of structs containing the actions including:
359
+ # * action (String) = The action taken (open or click).
360
+ # * timestamp (DateTime) = Time the action occurred.
361
+ # * url (String) = For clicks, the URL that was clicked.
362
+ #
356
363
  def email_stats(campaign_id, email)
357
- # Given a campaign and email address, return the entire click and open history with timestamps, ordered by time.
358
- # Note: Requires the AIM module to be installed.
359
- #
360
- # Parameters:
361
- # campaign_id (String) = The ID of the campaign.
362
- # email (String) = The email address to check OR the email "id" returned from listMemberInfo, Webhooks, and Campaigns.
363
- #
364
- # Returns:
365
- # An array of structs containing the actions including:
366
- # action (String) = The action taken (open or click).
367
- # timestamp (DateTime) = Time the action occurred.
368
- # url (String) = For clicks, the URL that was clicked.
369
- #
370
364
  call("campaignEmailStatsAIM", campaign_id, email)
371
365
  end
372
366
  alias :email_stats_aim :email_stats
373
367
 
368
+ # Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time,
369
+ # for every user a campaign was delivered to.
370
+ # Note: Requires the AIM module to be installed.
371
+ #
372
+ # Parameters:
373
+ # * campaign_id (String) = The ID of the campaign.
374
+ # * start (Integer) = For large data sets, the page number to start at.
375
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 1000.
376
+ #
377
+ # Returns:
378
+ # An array of structs containing actions (opens and clicks) for each email, with timestamps including:
379
+ # * action (String) = The action taken (open or click).
380
+ # * timestamp (DateTime) = Time the action occurred.
381
+ # * url (String) = For clicks, the URL that was clicked.
382
+ #
374
383
  def email_stats_all(campaign_id, start = 0, limit = 100)
375
- # Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time,
376
- # for every user a campaign was delivered to.
377
- # Note: Requires the AIM module to be installed.
378
- #
379
- # Parameters:
380
- # campaign_id (String) = The ID of the campaign.
381
- # start (Integer) = For large data sets, the page number to start at.
382
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 1000.
383
- #
384
- # Returns:
385
- # An array of structs containing actions (opens and clicks) for each email, with timestamps including:
386
- # action (String) = The action taken (open or click).
387
- # timestamp (DateTime) = Time the action occurred.
388
- # url (String) = For clicks, the URL that was clicked.
389
- #
390
384
  call("campaignEmailStatsAIMAll", campaign_id, start, limit)
391
385
  end
392
386
  alias :email_stats_aim_all :email_stats_all
393
387
 
388
+ # Get all email addresses with Hard Bounces for a given campaign.
389
+ #
390
+ # Parameters:
391
+ # * campaign_id (String) = The ID of the campaign.
392
+ # * start (Integer) = For large data sets, the page number to start at.
393
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
394
+ #
395
+ # Returns:
396
+ # An array of email addresses with Hard Bounces.
397
+ #
394
398
  def hard_bounces(campaign_id, start = 0, limit = 1000)
395
- # Get all email addresses with Hard Bounces for a given campaign.
396
- #
397
- # Parameters:
398
- # campaign_id (String) = The ID of the campaign.
399
- # start (Integer) = For large data sets, the page number to start at.
400
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
401
- #
402
- # Returns:
403
- # An array of email addresses with Hard Bounces.
404
- #
405
399
  call("campaignHardBounces", campaign_id, start, limit)
406
400
  end
407
401
 
402
+ # Retrieve the list of email addresses that did not open a given campaign.
403
+ # Note: Requires the AIM module to be installed.
404
+ #
405
+ # Parameters:
406
+ # * campaign_id (String) = The ID of the campaign.
407
+ # * start (Integer) = For large data sets, the page number to start at.
408
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
409
+ #
410
+ # Returns:
411
+ # A list of email addresses that did not open a campaign.
412
+ #
408
413
  def not_opened(campaign_id, start = 0, limit = 1000)
409
- # Retrieve the list of email addresses that did not open a given campaign.
410
- # Note: Requires the AIM module to be installed.
411
- #
412
- # Parameters:
413
- # campaign_id (String) = The ID of the campaign.
414
- # start (Integer) = For large data sets, the page number to start at.
415
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
416
- #
417
- # Returns:
418
- # A list of email addresses that did not open a campaign.
419
- #
420
414
  call("campaignNotOpenedAIM", campaign_id, start, limit)
421
415
  end
422
416
  alias :not_opened_aim :not_opened
423
417
 
418
+ # Retrieve the list of email addresses that opened a given campaign with how many times they opened.
419
+ # Note: this AIM function is free and does not actually require the AIM module to be installed.
420
+ #
421
+ # Parameters:
422
+ # * campaign_id (String) = The ID of the campaign.
423
+ # * start (Integer) = For large data sets, the page number to start at.
424
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
425
+ #
426
+ # Returns:
427
+ # An array of structs containing email addresses and open counts including:
428
+ # * email (String) = Email address that opened the campaign.
429
+ # * open_count (Integer) = Total number of times the campaign was opened by this email address.
430
+ #
424
431
  def opened(campaign_id, start = 0, limit = 1000)
425
- # Retrieve the list of email addresses that opened a given campaign with how many times they opened.
426
- # Note: this AIM function is free and does not actually require the AIM module to be installed.
427
- #
428
- # Parameters:
429
- # campaign_id (String) = The ID of the campaign.
430
- # start (Integer) = For large data sets, the page number to start at.
431
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
432
- #
433
- # Returns:
434
- # An array of structs containing email addresses and open counts including:
435
- # email (String) = Email address that opened the campaign.
436
- # open_count (Integer) = Total number of times the campaign was opened by this email address.
437
- #
438
432
  call("campaignOpenedAIM", campaign_id, start, limit)
439
433
  end
440
434
  alias :opened_aim :opened
441
435
 
436
+ # Retrieve the Ecommerce Orders.
437
+ #
438
+ # Parameters:
439
+ # * campaign_id (String) = The ID of the campaign.
440
+ # * start (Integer) = For large data sets, the page number to start at.
441
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 500.
442
+ # * since (DateTime) = Pull only messages since this time - use YYYY-MM-DD HH:II:SS format in GMT.
443
+ #
444
+ # Returns:
445
+ # An array of orders and their details for this campaign, including:
446
+ # * store_id (String) = The store id generated by the plugin used to uniquely identify a store.
447
+ # * store_name (String) = The store name collected by the plugin - often the domain name.
448
+ # * order_id (Integer) = The internal order id the store tracked this order by.
449
+ # * email (String) = The email address that received this campaign and is associated with this order.
450
+ # * order_total (Double) = The order total.
451
+ # * tax_total (Double) = The total tax for the order (if collected).
452
+ # * ship_total (Double) = The shipping total for the order (if collected).
453
+ # * order_date (String) = The date the order was tracked - from the store if possible, otherwise the GMT time received.
454
+ # * lines (Array) = Containing details of the order - product, category, quantity, item cost.
455
+ #
442
456
  def orders(campaign_id, start = 0, limit = 100, since = "2001-01-01 00:00:00")
443
- # Retrieve the Ecommerce Orders.
444
- #
445
- # Parameters:
446
- # campaign_id (String) = The ID of the campaign.
447
- # start (Integer) = For large data sets, the page number to start at.
448
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 500.
449
- # since (DateTime) = Pull only messages since this time - use YYYY-MM-DD HH:II:SS format in GMT.
450
- #
451
- # Returns:
452
- # An array of orders and their details for this campaign, including:
453
- # store_id (String) = The store id generated by the plugin used to uniquely identify a store.
454
- # store_name (String) = The store name collected by the plugin - often the domain name.
455
- # order_id (Integer) = The internal order id the store tracked this order by.
456
- # email (String) = The email address that received this campaign and is associated with this order.
457
- # order_total (Double) = The order total.
458
- # tax_total (Double) = The total tax for the order (if collected).
459
- # ship_total (Double) = The shipping total for the order (if collected).
460
- # order_date (String) = The date the order was tracked - from the store if possible, otherwise the GMT time received.
461
- # lines (Array) = Containing details of the order - product, category, quantity, item cost.
462
- #
463
457
  call("campaignEcommOrders", campaign_id, start, limit, since)
464
458
  end
465
459
  alias :ecomm_orders :orders
466
460
 
461
+ # Pause an AutoResponder orRSS campaign from sending.
462
+ #
463
+ # Parameters:
464
+ # * campaign_id (String) = The ID of the campaign.
465
+ #
466
+ # Returns:
467
+ # True if successful.
467
468
  def pause(campaign_id)
468
- # Pause an AutoResponder orRSS campaign from sending.
469
- #
470
- # Parameters:
471
- # campaign_id (String) = The ID of the campaign.
472
- #
473
- # Returns:
474
- # True if successful.
475
469
  call("campaignPause", campaign_id)
476
470
  end
477
471
 
472
+ # Replicate a campaign.
473
+ #
474
+ # Parameters:
475
+ # * campaign_id (String) = The ID of the campaign.
476
+ #
477
+ # Returns:
478
+ # The ID of the newly created replicated campaign. (String)
479
+ #
478
480
  def replicate(campaign_id)
479
- # Replicate a campaign.
480
- #
481
- # Parameters:
482
- # campaign_id (String) = The ID of the campaign.
483
- #
484
- # Returns:
485
- # The ID of the newly created replicated campaign. (String)
486
- #
487
481
  call("campaignReplicate", campaign_id)
488
482
  end
489
483
  alias :replicate_campaign :replicate
490
484
 
485
+ # Resume sending an AutoResponder or RSS campaign.
486
+ #
487
+ # Parameters:
488
+ # * campaign_id (String) = The ID of the campaign.
489
+ #
490
+ # Returns:
491
+ # True if successful.
492
+ #
491
493
  def resume(campaign_id)
492
- # Resume sending an AutoResponder or RSS campaign.
493
- #
494
- # Parameters:
495
- # campaign_id (String) = The ID of the campaign.
496
- #
497
- # Returns:
498
- # True if successful.
499
- #
500
494
  call("campaignResume", campaign_id)
501
495
  end
502
496
 
497
+ # Schedule a campaign to be sent in the future.
498
+ #
499
+ # Parameters:
500
+ # * campaign_id (String) = The ID of the campaign.
501
+ # * time (DateTime) = The time to schedule the campaign. For A/B Split "schedule" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in GMT.
502
+ # * time_b (DateTime) = The time to schedule Group B of an A/B Split "schedule" campaign - in YYYY-MM-DD HH:II:SS format in GMT. (optional)
503
+ #
504
+ # Returns:
505
+ # True if successful.
506
+ #
503
507
  def schedule(campaign_id, time = "#{1.day.from_now}", time_b = "")
504
- # Schedule a campaign to be sent in the future.
505
- #
506
- # Parameters:
507
- # campaign_id (String) = The ID of the campaign.
508
- # time (DateTime) = The time to schedule the campaign. For A/B Split "schedule" campaigns, the time
509
- # for Group A - in YYYY-MM-DD HH:II:SS format in GMT.
510
- # time_b (DateTime) = The time to schedule Group B of an A/B Split "schedule" campaign - in
511
- # YYYY-MM-DD HH:II:SS format in GMT. (optional)
512
- #
513
- # Returns:
514
- # True if successful.
515
- #
516
508
  call("campaignSchedule", campaign_id, time, time_b)
517
509
  end
518
510
  alias :schedule_campaign :schedule
519
511
 
512
+ # Send this campaign immediately.
513
+ #
514
+ # Parameters:
515
+ # * campaign_id (String) = The ID of the campaign to send.
516
+ #
517
+ # Returns:
518
+ # True if successful.
520
519
  def send(campaign_id)
521
- # Send this campaign immediately.
522
- #
523
- # Parameters:
524
- # campaign_id (String) = The ID of the campaign to send.
525
- #
526
- # Returns:
527
- # True if successful.
528
520
  call("campaignSendNow", campaign_id)
529
521
  end
530
522
  alias :send_now :send
531
523
 
524
+ # Send a test of this campaign to the provided email address(es).
525
+ #
526
+ # Parameters:
527
+ # * campaign_id (String) = The ID of the campaign.
528
+ # * emails (Hash) = A hash of email addresses to receive the test message.
529
+ # * send_type (String) = One of 'html', 'text' or nil (send both). Defaults to nil.
530
+ #
531
+ # Returns:
532
+ # True if successful.
533
+ #
532
534
  def send_test(campaign_id, emails = {}, send_type = nil)
533
- # Send a test of this campaign to the provided email address(es).
534
- #
535
- # Parameters:
536
- # campaign_id (String) = The ID of the campaign.
537
- # emails (Hash) = A hash of email addresses to receive the test message.
538
- # send_type (String) = One of 'html', 'text' or nil (send both). Defaults to nil.
539
- #
540
- # Returns:
541
- # True if successful.
542
- #
543
535
  call("campaignSendTest", campaign_id, emails, send_type)
544
536
  end
545
537
 
538
+ # Get the URL to a customized VIP Report for the specified campaign and optionally send an email
539
+ # to someone with links to it. Note subsequent calls will overwrite anything already set for the
540
+ # same campign (eg, the password).
541
+ #
542
+ # Parameters:
543
+ # * campaign_id (String) = The ID of the campaign.
544
+ # * options (Hash) = A hash of parameters which can be used to configure the shared report, including: (optional)
545
+ # * header_type (String) = One of "text" or "image". Defaults to 'text'. (optional)
546
+ # * header_data (String) = If "header_type" is text, the text to display. If "header_type" is "image" a valid URL to an image file. Note that images will be resized to be no more than 500x150. Defaults to the Accounts Company Name. (optional)
547
+ # * secure (Boolean) = Whether to require a password for the shared report. Defaults to "true". (optional)
548
+ # * password (String) = If secure is true and a password is not included, we will generate one. It is always returned. (optional)
549
+ # * to_email (String) = Email address to share the report with - no value means an email will not be sent. (optional)
550
+ # * theme (Array) = An array containing either 3 or 6 character color code values for: "bg_color", "header_color", "current_tab", "current_tab_text", "normal_tab", "normal_tab_text", "hover_tab", "hover_tab_text". (optional)
551
+ # * css_url (String) = A link to an external CSS file to be included after our default CSS (http://vip-reports.net/css/vip.css) only if loaded via the "secure_url" - max 255 characters. (optional)
552
+ #
553
+ # Returns:
554
+ # A struct containing details for the shared report including:
555
+ # * title (String) = The Title of the Campaign being shared.
556
+ # * url (String) = The URL to the shared report.
557
+ # * secure_url (String) = The URL to the shared report, including the password (good for loading in an IFRAME). For non-secure reports, this will not be returned.
558
+ # * password (String) = If secured, the password for the report, otherwise this field will not be returned.
559
+ #
546
560
  def share_report(campaign_id, options = {})
547
- # Get the URL to a customized VIP Report for the specified campaign and optionally send an email
548
- # to someone with links to it. Note subsequent calls will overwrite anything already set for the
549
- # same campign (eg, the password).
550
- #
551
- # Parameters:
552
- # campaign_id (String) = The ID of the campaign.
553
- # options (Hash) = A hash of parameters which can be used to configure the shared report, including: (optional)
554
- # header_type (String) = One of "text" or "image". Defaults to 'text'. (optional)
555
- # header_data (String) = If "header_type" is text, the text to display. If "header_type" is "image"
556
- # a valid URL to an image file. Note that images will be resized to be no more
557
- # than 500x150. Defaults to the Accounts Company Name. (optional)
558
- # secure (Boolean) = Whether to require a password for the shared report. Defaults to "true". (optional)
559
- # password (String) = If secure is true and a password is not included, we will generate one. It is always returned. (optional)
560
- # to_email (String) = Email address to share the report with - no value means an email will not be sent. (optional)
561
- # theme (Array) = An array containing either 3 or 6 character color code values for: "bg_color",
562
- # "header_color", "current_tab", "current_tab_text", "normal_tab", "normal_tab_text",
563
- # "hover_tab", "hover_tab_text". (optional)
564
- # css_url (String) = A link to an external CSS file to be included after our default CSS
565
- # (http://vip-reports.net/css/vip.css) only if loaded via the "secure_url"
566
- # - max 255 characters. (optional)
567
- #
568
- # Returns:
569
- # A struct containing details for the shared report including:
570
- # title (String) = The Title of the Campaign being shared.
571
- # url (String) = The URL to the shared report.
572
- # secure_url (String) = The URL to the shared report, including the password (good for loading in an IFRAME).
573
- # For non-secure reports, this will not be returned.
574
- # password (String) = If secured, the password for the report, otherwise this field will not be returned.
575
- #
576
561
  call("campaignShareReport", campaign_id, options)
577
562
  end
578
563
 
564
+ # Get all email addresses with Soft Bounces for a given campaign.
565
+ #
566
+ # Parameters:
567
+ # * campaign_id (String) = The ID of the campaign.
568
+ # * start (Integer) = For large data sets, the page number to start at.
569
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
570
+ #
571
+ # Returns:
572
+ # An array of email addresses with Soft Bounces.
573
+ #
579
574
  def soft_bounces(campaign_id, start = 0, limit = 1000)
580
- # Get all email addresses with Soft Bounces for a given campaign.
581
- #
582
- # Parameters:
583
- # campaign_id (String) = The ID of the campaign.
584
- # start (Integer) = For large data sets, the page number to start at.
585
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
586
- #
587
- # Returns:
588
- # An array of email addresses with Soft Bounces.
589
- #
590
575
  call("campaignSoftBounces", campaign_id, start, limit)
591
576
  end
592
577
 
578
+ # Get all the relevant campaign statistics for this campaign.
579
+ #
580
+ # Parameters:
581
+ # * campaign_id (String) = The ID of the campaign.
582
+ #
583
+ # Returns:
584
+ # An array of statistics for this campaign including:
585
+ # * syntax_error (Integer) = Number of email addresses in campaign that had syntactical errors.
586
+ # * hard_bounces (Integer) = Number of email addresses in campaign that hard bounced.
587
+ # * soft_bounces (Integer) = Number of email addresses in campaign that soft bounced.
588
+ # * unsubscribes (Integer) = Number of email addresses in campaign that unsubscribed.
589
+ # * abuse_reports (Integer) = Number of email addresses in campaign that reported campaign for abuse.
590
+ # * forwards (Integer) = Number of times email was forwarded to a friend.
591
+ # * forwards_opens (Integer) = Number of times a forwarded email was opened.
592
+ # * opens (Integer) = Number of times the campaign was opened.
593
+ # * last_open (Date) = Date of the last time the email was opened.
594
+ # * unique_opens (Integer) = Number of people who opened the campaign.
595
+ # * clicks (Integer) = Number of times a link in the campaign was clicked.
596
+ # * unique_clicks (Integer) = Number of unique recipient/click pairs for the campaign.
597
+ # * last_click (Date) = Date of the last time a link in the email was clicked.
598
+ # * users_who_clicked (Integer) = Number of unique recipients who clicked on a link in the campaign.
599
+ # * emails_sent (Integer) = Number of email addresses campaign was sent to.
600
+ #
593
601
  def stats(campaign_id)
594
- # Get all the relevant campaign statistics for this campaign.
595
- #
596
- # Parameters:
597
- # campaign_id (String) = The ID of the campaign.
598
- #
599
- # Returns:
600
- # An array of statistics for this campaign including:
601
- # syntax_error (Integer) = Number of email addresses in campaign that had syntactical errors.
602
- # hard_bounces (Integer) = Number of email addresses in campaign that hard bounced.
603
- # soft_bounces (Integer) = Number of email addresses in campaign that soft bounced.
604
- # unsubscribes (Integer) = Number of email addresses in campaign that unsubscribed.
605
- # abuse_reports (Integer) = Number of email addresses in campaign that reported campaign for abuse.
606
- # forwards (Integer) = Number of times email was forwarded to a friend.
607
- # forwards_opens (Integer) = Number of times a forwarded email was opened.
608
- # opens (Integer) = Number of times the campaign was opened.
609
- # last_open (Date) = Date of the last time the email was opened.
610
- # unique_opens (Integer) = Number of people who opened the campaign.
611
- # clicks (Integer) = Number of times a link in the campaign was clicked.
612
- # unique_clicks (Integer) = Number of unique recipient/click pairs for the campaign.
613
- # last_click (Date) = Date of the last time a link in the email was clicked.
614
- # users_who_clicked (Integer) = Number of unique recipients who clicked on a link in the campaign.
615
- # emails_sent (Integer) = Number of email addresses campaign was sent to.
616
- #
617
602
  call("campaignStats", campaign_id)
618
603
  end
619
604
  alias :campaign_stats :stats
620
605
 
606
+ # Update just about any setting for a campaign that has not been sent.
607
+ #
608
+ # Parameters:
609
+ # * campaign_id (String) = The ID of the campaign.
610
+ # * name (String) = The parameter name.
611
+ # * value (Variable) = An appropriate value for the parameter.
612
+ #
613
+ # Returns:
614
+ # True if successful, error code if not.
615
+ #
621
616
  def update(campaign_id, name, value)
622
- # Update just about any setting for a campaign that has not been sent.
623
- #
624
- # Parameters:
625
- # campaign_id (String) = The ID of the campaign.
626
- # name (String) = The parameter name.
627
- # value (Variable) = An appropriate value for the parameter.
628
- #
629
- # Returns:
630
- # True if successful, error code if not.
631
- #
632
617
  call("campaignUpdate", campaign_id, name, value)
633
618
  end
634
619
 
620
+ # Unschedule a campaign that is scheduled to be sent in the future.
621
+ #
622
+ # Parameters:
623
+ # * campaign_id (String) = The ID of the campaign.
624
+ #
625
+ # Returns:
626
+ # True if successful.
627
+ #
635
628
  def unschedule(campaign_id)
636
- # Unschedule a campaign that is scheduled to be sent in the future.
637
- #
638
- # Parameters:
639
- # campaign_id (String) = The ID of the campaign.
640
- #
641
- # Returns:
642
- # True if successful.
643
- #
644
629
  call("campaignUnschedule", campaign_id)
645
630
  end
646
631
 
632
+ # Get all unsubscribed email addresses for a given campaign.
633
+ #
634
+ # Parameters:
635
+ # * campaign_id (String) = The ID of the campaign.
636
+ # * start (Integer) = For large data sets, the page number to start at.
637
+ # * limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
638
+ #
639
+ # Returns:
640
+ # An array of email addresses that unsubscribed from this campaign.
641
+ #
647
642
  def unsubsribes(campaign_id, start = 0, limit = 1000)
648
- # Get all unsubscribed email addresses for a given campaign.
649
- #
650
- # Parameters:
651
- # campaign_id (String) = The ID of the campaign.
652
- # start (Integer) = For large data sets, the page number to start at.
653
- # limit (Integer) = For large data sets, the number of results to return. Upper limit set at 15000.
654
- #
655
- # Returns:
656
- # An array of email addresses that unsubscribed from this campaign.
657
- #
658
643
  call("campaignUnsubscribes", campaign_id, start, limit)
659
644
  end
660
645