gnumarcelo-campaigning 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/VERSION.yml +2 -2
- data/lib/campaigning/{types/campaign.rb → campaign.rb} +12 -14
- data/lib/campaigning/campaigning.rb +25 -21
- data/lib/campaigning/client.rb +309 -0
- data/lib/campaigning/{types/list.rb → list.rb} +58 -61
- data/lib/campaigning/{helpers/helpers.rb → module_mixin.rb} +9 -5
- data/lib/campaigning/subscriber.rb +145 -0
- data/test/campaigning_test.rb +146 -144
- metadata +7 -8
- data/lib/campaigning/soap/soap_driver.rb +0 -30
- data/lib/campaigning/types/client.rb +0 -312
- data/lib/campaigning/types/subscriber.rb +0 -185
data/README.rdoc
CHANGED
@@ -45,7 +45,7 @@ Sample use of the Client class:
|
|
45
45
|
|
46
46
|
#Here is how to create a brand new subscriber list for an Client
|
47
47
|
client = Campaigning::Client.find_by_name("Client One Company")
|
48
|
-
list = Campaigning::List.create(
|
48
|
+
list = Campaigning::List.create!(
|
49
49
|
:clientID => client.clientID,
|
50
50
|
:title => "List of people from Brazil",
|
51
51
|
:confirmOptIn => false
|
data/VERSION.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# Campaign is defined in soap/default.rb which is automatically generated.
|
2
2
|
# In this file we add additional methods to the Campaign class.
|
3
|
-
require File.expand_path(File.dirname(__FILE__)) + '
|
3
|
+
require File.expand_path(File.dirname(__FILE__)) + '/module_mixin'
|
4
4
|
|
5
5
|
|
6
6
|
module Campaigning
|
7
|
-
|
8
7
|
class Campaign
|
9
|
-
include
|
8
|
+
include ModuleMixin
|
10
9
|
attr_accessor :campaignID
|
11
10
|
attr_accessor :subject
|
12
11
|
attr_accessor :sentDate
|
@@ -17,7 +16,6 @@ module Campaigning
|
|
17
16
|
@subject = subject
|
18
17
|
@sentDate = sentDate
|
19
18
|
@totalRecipients = totalRecipients
|
20
|
-
@soap = Campaigning::SOAPDriver.instance.get_driver
|
21
19
|
end
|
22
20
|
|
23
21
|
#Creates a campaign for an existing client. This campaign will be imported and ready to send to the subscribers in
|
@@ -43,8 +41,8 @@ module Campaigning
|
|
43
41
|
#*Success*: Upon a successful call, this method will return a Campaigning::Campaign object which was recently created.
|
44
42
|
#
|
45
43
|
#*Error*: An Exception containing the cause of the error will be raised.
|
46
|
-
def self.create(params)
|
47
|
-
response =
|
44
|
+
def self.create!(params)
|
45
|
+
response = @@soap.createCampaign(
|
48
46
|
:apiKey => CAMPAIGN_MONITOR_API_KEY,
|
49
47
|
:clientID => params[:clientID],
|
50
48
|
:campaignName => params[:campaignName],
|
@@ -72,7 +70,7 @@ module Campaigning
|
|
72
70
|
#
|
73
71
|
#*Error*: An Exception containing the cause of the error will be raised.
|
74
72
|
def bounces
|
75
|
-
response =
|
73
|
+
response = @@soap.getCampaignBounces(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
76
74
|
handle_response response.campaign_GetBouncesResult
|
77
75
|
end
|
78
76
|
|
@@ -84,7 +82,7 @@ module Campaigning
|
|
84
82
|
#
|
85
83
|
#*Error*: An Exception containing the cause of the error will be raised.
|
86
84
|
def lists
|
87
|
-
response =
|
85
|
+
response = @@soap.getCampaignLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
88
86
|
lists = handle_response response.campaign_GetListsResult
|
89
87
|
lists.collect do |list|
|
90
88
|
List.new(list.listID, list.name)
|
@@ -101,7 +99,7 @@ module Campaigning
|
|
101
99
|
#
|
102
100
|
#*Error*: An Exception containing the cause of the error will be raised.
|
103
101
|
def opens
|
104
|
-
response =
|
102
|
+
response = @@soap.getCampaignOpens(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
105
103
|
handle_response response.campaign_GetOpensResult
|
106
104
|
end
|
107
105
|
|
@@ -126,7 +124,7 @@ module Campaigning
|
|
126
124
|
#
|
127
125
|
#*Error*: An Exception containing the cause of the error will be raised.
|
128
126
|
def subscriber_clicks
|
129
|
-
response =
|
127
|
+
response = @@soap.getSubscriberClicks(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
130
128
|
handle_response response.campaign_GetSubscriberClicksResult
|
131
129
|
end
|
132
130
|
|
@@ -140,7 +138,7 @@ module Campaigning
|
|
140
138
|
#
|
141
139
|
#*Error*: An Exception containing the cause of the error will be raised.
|
142
140
|
def summary
|
143
|
-
response =
|
141
|
+
response = @@soap.getCampaignSummary(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
144
142
|
handle_response response.campaign_GetSummaryResult
|
145
143
|
end
|
146
144
|
|
@@ -153,7 +151,7 @@ module Campaigning
|
|
153
151
|
#
|
154
152
|
#*Error*: An Exception containing the cause of the error will be raised.
|
155
153
|
def unsubscribes
|
156
|
-
response =
|
154
|
+
response = @@soap.getCampaignUnsubscribes(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
|
157
155
|
handle_response response.campaign_GetUnsubscribesResult
|
158
156
|
end
|
159
157
|
|
@@ -173,8 +171,8 @@ module Campaigning
|
|
173
171
|
#Upon a successful call, this method will return a Result object with the newly create Campaign's ID as the Code.
|
174
172
|
#
|
175
173
|
#*Error*: An Exception containing the cause of the error will be raised.
|
176
|
-
def send(params)
|
177
|
-
response =
|
174
|
+
def send!(params)
|
175
|
+
response = @@soap.sendCampaign(
|
178
176
|
:apiKey => CAMPAIGN_MONITOR_API_KEY,
|
179
177
|
:campaignID => @campaignID,
|
180
178
|
:confirmationEmail => params[:confirmationEmail],
|
@@ -1,40 +1,44 @@
|
|
1
1
|
gem "soap4r", "~> 1.5.0"
|
2
|
-
require File.expand_path(File.dirname(__FILE__)) + '/
|
3
|
-
require File.expand_path(File.dirname(__FILE__)) + '/
|
4
|
-
require File.expand_path(File.dirname(__FILE__)) + '/
|
5
|
-
require File.expand_path(File.dirname(__FILE__)) + '/
|
6
|
-
require File.expand_path(File.dirname(__FILE__)) + '/
|
7
|
-
require File.expand_path(File.dirname(__FILE__)) + '/helpers/helpers.rb'
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/client.rb'
|
3
|
+
require File.expand_path(File.dirname(__FILE__)) + '/campaign.rb'
|
4
|
+
require File.expand_path(File.dirname(__FILE__)) + '/subscriber.rb'
|
5
|
+
require File.expand_path(File.dirname(__FILE__)) + '/list.rb'
|
6
|
+
require File.expand_path(File.dirname(__FILE__)) + '/module_mixin.rb'
|
8
7
|
|
9
8
|
module Campaigning
|
10
|
-
include
|
9
|
+
include ModuleMixin
|
11
10
|
|
11
|
+
##
|
12
12
|
#Gets the server system time for your time zone.
|
13
13
|
#This is handy for when you are syncing your {Campaign Monitor}[http://www.campaignmonitor.com] lists with some other in-house list,
|
14
14
|
#allowing you accurately determine the time on our server when you carry out the synchronization.
|
15
15
|
def self.system_date
|
16
|
-
response =
|
16
|
+
response = @@soap.getSystemDate(:apiKey => CAMPAIGN_MONITOR_API_KEY)
|
17
17
|
dateTime = handle_response response.user_GetSystemDateResult
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
|
+
##
|
20
21
|
#This method returns an Array of Strings representing all the available timezones.
|
21
|
-
def self.timezones
|
22
|
-
handle_response
|
22
|
+
def self.timezones
|
23
|
+
handle_response @@soap.getTimezones(:apiKey => CAMPAIGN_MONITOR_API_KEY).user_GetTimezonesResult
|
23
24
|
end
|
24
|
-
|
25
|
+
|
26
|
+
##
|
25
27
|
#This method returns an Array of Strings representing all the available countries.
|
26
28
|
def self.countries
|
27
|
-
response =
|
29
|
+
response = @@soap.getCountries(:apiKey => CAMPAIGN_MONITOR_API_KEY)
|
28
30
|
dateTime = handle_response response.user_GetCountriesResult
|
29
31
|
end
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
|
33
|
+
##
|
34
|
+
#This method turns the API debug mode to :on and :off, which will display at the console all SOAP requests made to the API server.
|
35
|
+
#
|
36
|
+
def self.set_debug_mode(option)
|
37
|
+
option = STDERR if option == :on
|
38
|
+
@@soap.wiredump_dev = option
|
39
|
+
end
|
40
|
+
|
37
41
|
def self.set_endpoint_url(endpoint_url)
|
38
|
-
|
42
|
+
@@soap = Campaigning::ApiSoap.new(endpoint_url)
|
39
43
|
end
|
40
44
|
end
|
@@ -0,0 +1,309 @@
|
|
1
|
+
# Client is defined in default.rb which is automatically generated.
|
2
|
+
# In this file we add additional methods to the Client class.
|
3
|
+
require File.expand_path(File.dirname(__FILE__)) + '/module_mixin'
|
4
|
+
|
5
|
+
module Campaigning
|
6
|
+
class Client
|
7
|
+
include ModuleMixin
|
8
|
+
attr_accessor :clientID
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
def initialize(clientID = nil, name = nil)
|
12
|
+
@clientID = clientID
|
13
|
+
@name = name
|
14
|
+
end
|
15
|
+
|
16
|
+
#Gets a list of all subscriber lists for a client.
|
17
|
+
#
|
18
|
+
#*Return*:
|
19
|
+
#
|
20
|
+
#*Success*: Upon a successful call, this method will return a collection of Campaigning::List objects.
|
21
|
+
#
|
22
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
23
|
+
def lists
|
24
|
+
response = @@soap.getClientLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID)
|
25
|
+
lists = handle_response response.client_GetListsResult
|
26
|
+
lists.collect {|list| List.new(list.listID, list.name)}
|
27
|
+
end
|
28
|
+
|
29
|
+
#This method find a List by a given name
|
30
|
+
#
|
31
|
+
#*Return*:
|
32
|
+
#
|
33
|
+
#*Success*:
|
34
|
+
#
|
35
|
+
#List FOUND: If it found any client with the given name it will return a Campaigning::List object containing the found list.
|
36
|
+
#
|
37
|
+
#List NOT FOUND: If it doesn't found a list with the given name it will return +nil+ .
|
38
|
+
#
|
39
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
40
|
+
def find_list_by_name(list_name)
|
41
|
+
lists.find {|list| list_name == list.name}
|
42
|
+
end
|
43
|
+
|
44
|
+
#This method find a Client by a given name
|
45
|
+
#
|
46
|
+
#*Return*:
|
47
|
+
#
|
48
|
+
#Client FOUND: If it found any client with the given name it will return a Campaigning::Client object containing the found client.
|
49
|
+
#
|
50
|
+
#Client NOT FOUND: If it doesn't found a client with the given name it will return +nil+ .
|
51
|
+
#
|
52
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
53
|
+
#-- TODO: Refactor this method and increase performance?
|
54
|
+
#-- TODO: Tha campaign monitor permit two users with the same name, what to do?
|
55
|
+
def self.find_by_name(name)
|
56
|
+
client_list = Client.get_all_clients
|
57
|
+
client_found = client_list.find {|client| name == client.name}
|
58
|
+
Client.new(client_found.clientID, client_found.name) if client_found
|
59
|
+
end
|
60
|
+
|
61
|
+
#Gets all clients for a given user (CAMPAIGN_MONITOR_API_KEY).
|
62
|
+
#
|
63
|
+
#*Return*:
|
64
|
+
#
|
65
|
+
#*Success*: Upon a successful call, this method will return a collection of Campaigning::Client objects.
|
66
|
+
#
|
67
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
68
|
+
def self.get_all_clients
|
69
|
+
response = @@soap.getClients(:apiKey => CAMPAIGN_MONITOR_API_KEY)
|
70
|
+
clients = handle_response response.user_GetClientsResult
|
71
|
+
clients.collect {|client| Client.new(client.clientID, client.name)}
|
72
|
+
end
|
73
|
+
|
74
|
+
#This method creates a brand new client with no access to the application.
|
75
|
+
#By default a new client has no direct access to the application. Access and billing settings (if needed) must be set by
|
76
|
+
#means of a subsequent call to Campaigning::Client#update_access_and_billing!.
|
77
|
+
#
|
78
|
+
#Available _params_ argument are:
|
79
|
+
# * :companyName - The client company name.
|
80
|
+
# * :contactName - The personal name of the principle contact for this client.
|
81
|
+
# * :emailAddress - An email address to which this client will be sent application-related emails.
|
82
|
+
# * :country - This client's country. A valid country list is available in http://www.campaignmonitor.com/api/countries/ or by
|
83
|
+
# using the API procedure Campaigning.countries
|
84
|
+
# * :timezone - Client timezone for tracking and reporting data. A valid timezone list is available here or by using the API
|
85
|
+
# procedure Campaigning.timezones.
|
86
|
+
#*Return*:
|
87
|
+
#
|
88
|
+
#*Success*: Upon a successful call, this method will return a Campaigning::Client object representing the newly created client.
|
89
|
+
#
|
90
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
91
|
+
def self.create!(params)
|
92
|
+
response = @@soap.createClient(
|
93
|
+
:apiKey => CAMPAIGN_MONITOR_API_KEY,
|
94
|
+
:companyName => params[:companyName],
|
95
|
+
:contactName => params[:contactName],
|
96
|
+
:emailAddress => params[:emailAddress],
|
97
|
+
:country => params[:country],
|
98
|
+
:timezone => params[:timezone]
|
99
|
+
)
|
100
|
+
Client.new( handle_response(response.client_CreateResult), params[:companyName] )
|
101
|
+
end
|
102
|
+
|
103
|
+
#Deletes a client from your account.
|
104
|
+
#
|
105
|
+
#*Return*:
|
106
|
+
#
|
107
|
+
#*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
|
108
|
+
#containing a successful message.
|
109
|
+
#
|
110
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
111
|
+
def delete!
|
112
|
+
response = Client.delete!(@clientID)
|
113
|
+
self.clientID, self.name = nil
|
114
|
+
response
|
115
|
+
end
|
116
|
+
|
117
|
+
#Deletes a client from your account.
|
118
|
+
#
|
119
|
+
#*Return*:
|
120
|
+
#
|
121
|
+
#*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
|
122
|
+
#containing a successful message.
|
123
|
+
#
|
124
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
125
|
+
def self.delete!(client_id)
|
126
|
+
response = @@soap.deleteClient(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => client_id)
|
127
|
+
handle_response response.client_DeleteResult
|
128
|
+
end
|
129
|
+
|
130
|
+
#Gets a list of all subscriber segments for a client.
|
131
|
+
#
|
132
|
+
#*Return*:
|
133
|
+
#
|
134
|
+
#*Success*: Upon a successful call, this method will return a collection of Campaigning::List objects, each of which consists of the ListID
|
135
|
+
#for the parent list and Segment Name for each segment for a client.
|
136
|
+
#
|
137
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
138
|
+
def segments # TODO: Verify the type return for this method.
|
139
|
+
response = @@soap.getClientSegments(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
|
140
|
+
handle_response response.client_GetSegmentsResult
|
141
|
+
end
|
142
|
+
|
143
|
+
#This method finds campaigns by a given subject, since the subject isn't unique, it returns an collection of
|
144
|
+
#Campaigning::Campaign object.
|
145
|
+
#
|
146
|
+
#*Return*:
|
147
|
+
#
|
148
|
+
#*Success*: Upon a successful call, this method will return a collection of Campaigning::Campaign objects.
|
149
|
+
#
|
150
|
+
#Campaign FOUND: If it found any campaign with the given subject it will return a collection of Campaigning::Campaign that match the criteria.
|
151
|
+
#
|
152
|
+
#Campaign NOT FOUND: If it doesn't found a campaign with the given subject it will return an empty array.
|
153
|
+
#
|
154
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
155
|
+
def find_campaigns_by_subject(subject)#-- TODO: Refactor this method
|
156
|
+
arr = []
|
157
|
+
#return campaigns.find {|campaign| subject == campaign.subject} if params[:single]
|
158
|
+
campaigns.each { |campaign| arr << campaign if campaign.subject == subject }
|
159
|
+
arr
|
160
|
+
end
|
161
|
+
|
162
|
+
#Gets a list of all campaigns that have been sent for a client.
|
163
|
+
#
|
164
|
+
#*Return*:
|
165
|
+
#
|
166
|
+
#*Success*: Upon a successful call, this method will return a collection of Campaigning::Campaign objects.
|
167
|
+
#
|
168
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
169
|
+
def campaigns
|
170
|
+
response = @@soap.getClientCampaigns(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
|
171
|
+
campaign_list = handle_response response.client_GetCampaignsResult
|
172
|
+
campaign_list.collect do |campaign|
|
173
|
+
Campaign.new(campaign.campaignID, campaign.subject, campaign.sentDate, campaign.totalRecipients)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
#This method gets the complete account and billing details for a particular client.
|
178
|
+
#
|
179
|
+
#Example of usage:
|
180
|
+
# client_details = client_obj.details
|
181
|
+
# basic_details = client_details.basicDetails
|
182
|
+
# access_and_billing_details = client_details.accessAndBilling
|
183
|
+
# puts "Basic details:"
|
184
|
+
# puts "Client ID: #{basic_details.clientID}\n
|
185
|
+
# Company: #{basic_details.companyName}\n
|
186
|
+
# Contact: #{basic_details.contactName}\n
|
187
|
+
# Country: #{basic_details.country}\n
|
188
|
+
# Timezone: #{basic_details.timezone}"
|
189
|
+
#
|
190
|
+
# puts "Access and Billing Details:"
|
191
|
+
# puts "Username: #{access_and_billing_details.username}\n
|
192
|
+
# Password: #{access_and_billing_details.password}\n
|
193
|
+
# Billing Type: #{access_and_billing_details.billingType}\n
|
194
|
+
# Currency: #{access_and_billing_details.currency}\n
|
195
|
+
# Delivery Fee: #{access_and_billing_details.deliveryFee}\n
|
196
|
+
# Cost per Recipient: #{access_and_billing_details.costPerRecipient}\n
|
197
|
+
# Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee}\n
|
198
|
+
# Access Level: #{access_and_billing_details.accessLevel}"
|
199
|
+
#
|
200
|
+
#*Return*:
|
201
|
+
#
|
202
|
+
#*Success*: A successful call to this method will return a ClientDetail object, comprised of ClientBasicDetails
|
203
|
+
#and ClientAccessAndBilling.
|
204
|
+
#
|
205
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
206
|
+
def details
|
207
|
+
response = @@soap.getClientDetail(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
|
208
|
+
handle_response response.client_GetDetailResult
|
209
|
+
end
|
210
|
+
|
211
|
+
#Gets all subscribers in the client-wide suppression list.
|
212
|
+
#
|
213
|
+
#*Return*:
|
214
|
+
#
|
215
|
+
#*Success*: Upon a successful call, this method will return a collection of Subscriber objects.
|
216
|
+
#
|
217
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
218
|
+
def suppression_list
|
219
|
+
response = @@soap.getClientSuppressionList(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
|
220
|
+
handle_response response.client_GetSuppressionListResult
|
221
|
+
end
|
222
|
+
|
223
|
+
#Update the access and billing settings of an existing client, leaving the basic details untouched.
|
224
|
+
#
|
225
|
+
#Here's a list of all the parameters you'll need to pass to the Campaigning::Client#update_access_and_billing! method. Only the :+access_level+ parameter
|
226
|
+
#is required for all calls. The relevance and necessity of the other parameters depends on the chosen AccessLevel (and BillingType),
|
227
|
+
#and will be fully described along with each parameter.
|
228
|
+
#
|
229
|
+
#Available _params_ argument are:
|
230
|
+
# * :accessLevel - An integer describing the client's ability to access different areas of the application. Influences the significance
|
231
|
+
# and requirements of the following parameters. See http://www.campaignmonitor.com/api/method/client-updateaccessandbilling/#accesslevels
|
232
|
+
# for a full description of available levels.
|
233
|
+
# * :username - Client login username. Not required and ignored if AccessLevel is set to 0.
|
234
|
+
# * :password - Client login password. Not required and ignored if AccessLevel is set to 0.
|
235
|
+
# * :billingType - Client billing type, only required if :accessLevel is set to allow the client to create and send campaigns
|
236
|
+
# * :currency - Billing currency for this client, only required if :billingType is set to either ClientPaysAtStandardRate or
|
237
|
+
# ClientPaysWithMarkup. See full details: http://www.campaignmonitor.com/api/method/client-updateaccessandbilling/#currencies.
|
238
|
+
# * :deliveryFee - Flat rate delivery fee to be charged to the client for each campaign sent, expressed in the chosen currency's
|
239
|
+
# major unit, but without the currency symbol (for example, sending "6.5" means "$6.50" if USD is used). Only
|
240
|
+
# required if BillingType is set to ClientPaysWithMarkup, in which case it should be at least equal to the standard rate.
|
241
|
+
# Further detail is available at http://help.campaignmonitor.com/topic.aspx?t=118.
|
242
|
+
# * :costPerRecipient - Additional cost added to the campaign for each email address the campaign is sent to, expressed in the chosen
|
243
|
+
# currency's minor unit (for example, sending "1.5" means 1.5 cents per email address if USD is used). Only required
|
244
|
+
# if BillingType is set to ClientPaysWithMarkup, in which case it should be at least equal to the standard cost/recipient
|
245
|
+
# rate. Further detail is available at http://help.campaignmonitor.com/topic.aspx?t=118.
|
246
|
+
# * :designAndSpamTestFee - Expressed in the chosen currency's major unit (for example, sending "10" means "$10" if USD is used). Only required
|
247
|
+
# if BillingType is set to ClientPaysWithMarkup and client has access to design and spam tests, in which case the fee
|
248
|
+
# should be equal to or higher than the standard rate (identical to the standard DeliveryFee for that currency).
|
249
|
+
#
|
250
|
+
#
|
251
|
+
#
|
252
|
+
#Please note that for reasons of security there is no way to set a client's credit card details via the API. It will have to be done in the application.
|
253
|
+
#
|
254
|
+
#*Return*:
|
255
|
+
#
|
256
|
+
#*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
|
257
|
+
#containing a successful message.
|
258
|
+
#
|
259
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
260
|
+
def update_access_and_billing!(params)
|
261
|
+
response = @@soap.updateClientAccessAndBilling(
|
262
|
+
:apiKey => CAMPAIGN_MONITOR_API_KEY,
|
263
|
+
:clientID => @clientID,
|
264
|
+
:accessLevel => params[:accessLevel],
|
265
|
+
:username => params.fetch(:username, ""),
|
266
|
+
:password => params.fetch(:password, ""),
|
267
|
+
:billingType => params.fetch(:billingType, ""),
|
268
|
+
:currency => params.fetch(:currency, ""),
|
269
|
+
:deliveryFee => params.fetch(:deliveryFee, ""),
|
270
|
+
:costPerRecipient => params.fetch(:costPerRecipient, ""),
|
271
|
+
:designAndSpamTestFee => params.fetch(:designAndSpamTestFee, "")
|
272
|
+
)
|
273
|
+
handle_response response.client_UpdateAccessAndBillingResult
|
274
|
+
end
|
275
|
+
|
276
|
+
#Updates the basic details of an existing client.
|
277
|
+
#If you wish to change only some details, the others must be included as they currently are. Please note that the client's existing
|
278
|
+
#access and billing details will remain unchanged by a call to this method.
|
279
|
+
#
|
280
|
+
#Available _params_ argument are:
|
281
|
+
# * :companyName - The client company name.
|
282
|
+
# * :contactName - The personal name of the principle contact for this client.
|
283
|
+
# * :emailAddress - An email address to which this client will be sent application-related emails.
|
284
|
+
# * :country - This client's country.
|
285
|
+
# * :timezone - Client timezone for tracking and reporting data. Valid timezone strings are obtainable by means of the
|
286
|
+
# API procedure Campaigning.timezones.
|
287
|
+
#
|
288
|
+
#*Return*:
|
289
|
+
#
|
290
|
+
#*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
|
291
|
+
#containing a successful message.
|
292
|
+
#
|
293
|
+
#*Error*: An Exception containing the cause of the error will be raised.
|
294
|
+
def update_basics!(params)
|
295
|
+
response = @@soap.updateClientBasics(
|
296
|
+
:apiKey => CAMPAIGN_MONITOR_API_KEY,
|
297
|
+
:clientID => @clientID,
|
298
|
+
:companyName => params[:companyName],
|
299
|
+
:contactName => params[:contactName],
|
300
|
+
:emailAddress => params[:emailAddress],
|
301
|
+
:country => params[:country],
|
302
|
+
:timezone => params[:timezone]
|
303
|
+
)
|
304
|
+
handle_response response.client_UpdateBasicsResult
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
end
|
309
|
+
end
|