campaigning 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,158 @@
1
+ # Subscriber is defined in default.rb which is automatically generated.
2
+ # In this file we add additional methods to the Subscriber class.
3
+ require File.expand_path(File.dirname(__FILE__)) + '/module_mixin'
4
+
5
+ module Campaigning
6
+ class Subscriber
7
+ include ModuleMixin
8
+ attr_accessor :emailAddress
9
+ attr_accessor :name
10
+ attr_accessor :date
11
+ attr_accessor :state
12
+ attr_accessor :customFields
13
+
14
+ def initialize(emailAddress = nil, name = nil, date = nil, state = nil, customFields = nil, opts={})
15
+ @apiKey = opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY
16
+ @emailAddress = emailAddress
17
+ @name = name
18
+ @date = date
19
+ @state = state
20
+ @customFields = customFields
21
+ end
22
+
23
+
24
+ #Adds a subscriber to a subscriber list, including adding custom field data for the subscriber. If the subscriber
25
+ #(email address) already exists, the name value is updated with whatever is passed in.
26
+ #
27
+ #If the list has been set as double opt-in, they will be sent the verification email, otherwise they will be sent the
28
+ #confirmation email you have set up for the list being subscribed to.
29
+ #
30
+ #<b>Please note</b>: If the subscriber is in an inactive state or has previously been unsubscribed, they will *not* be re-added
31
+ #to the active list. Therefore, this method should be used with caution and only where suitable.
32
+ #
33
+ #*Return*:
34
+ #
35
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
36
+ #containing a successful message.
37
+ #
38
+ #*Error*: An Exception containing the cause of the error will be raised.
39
+ def add!(list_id, custom_fields={})
40
+ params = {
41
+ :apiKey => @apiKey,
42
+ :listID => list_id,
43
+ :email => @emailAddress,
44
+ :name => @name
45
+ }
46
+ if custom_fields.empty?
47
+ response = @@soap.addSubscriber(params)
48
+ handle_response response.subscriber_AddResult
49
+ else
50
+ params.merge!({:customFields => custom_fields_array(custom_fields)})
51
+ response = @@soap.addSubscriberWithCustomFields(params)
52
+ handle_response response.subscriber_AddWithCustomFieldsResult
53
+ end
54
+ end
55
+
56
+
57
+ #Adds a subscriber to a subscriber list, including adding custom field data for the subscriber. If the subscriber (email address) already exists,
58
+ #the name value is updated with whatever is passed in.
59
+ #
60
+ #If the list has been set as double opt-in, they will be sent the verification email, otherwise they will be sent the
61
+ #confirmation email you have set up for the list being subscribed to.
62
+ #
63
+ #<b>Please note</b>: If the subscriber is in an inactive state or has previously been unsubscribed, they will be re-added to
64
+ #the active list. Therefore, this method should be used with caution and only where suitable.
65
+ #
66
+ #*Return*:
67
+ #
68
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
69
+ #containing a successful message.
70
+ #
71
+ #*Error*: An Exception containing the cause of the error will be raised.
72
+ def add_and_resubscribe!(list_id, custom_fields={})
73
+ params = {
74
+ :apiKey => @apiKey,
75
+ :listID => list_id,
76
+ :email => @emailAddress,
77
+ :name => @name
78
+ }
79
+ if custom_fields.empty?
80
+ response = @@soap.addAndResubscribe(params)
81
+ handle_response response.subscriber_AddAndResubscribeResult
82
+ else
83
+ params.merge!({:customFields => custom_fields_array(custom_fields)})
84
+ response = @@soap.addAndResubscribeWithCustomFields(params)
85
+ handle_response response.subscriber_AddAndResubscribeWithCustomFieldsResult
86
+ end
87
+ end
88
+
89
+
90
+ #Changes the status of an Active Subscriber to an Unsubscribed Subscriber who will no longer receive
91
+ #campaigns sent to that Subscriber List.
92
+ #
93
+ #If the list is set to add unsubscribing subscribers to the suppression list, then the subscriber’s email address will
94
+ #also be added to the suppression list.
95
+ #
96
+ #*Return*:
97
+ #
98
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
99
+ #containing a successful message.
100
+ #
101
+ #*Error*: An Exception containing the cause of the error will be raised.
102
+ def unsubscribe!(list_id)
103
+ Subscriber.unsubscribe!(@emailAddress, list_id, :apiKey=> @apiKey)
104
+ end
105
+
106
+
107
+ #Changes the status of an Active Subscriber to an Unsubscribed Subscriber who will no longer receive
108
+ #campaigns sent to that Subscriber List (Same that the instance method with the same name).
109
+ #
110
+ #Aviable _opts_ arguments are:
111
+ # * :apiKey - optional API key to use to make request. Will use CAMPAIGN_MONITOR_API_KEY if not set.
112
+ def self.unsubscribe!(email, list_id, opts={})
113
+ response = @@soap.unsubscribe(
114
+ :apiKey => opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY,
115
+ :listID => list_id,
116
+ :email => email
117
+ )
118
+ handle_response response.subscriber_UnsubscribeResult
119
+ end
120
+
121
+ #Returns True or False as to the existence of the given email address in the list supplied.
122
+ def is_subscribed?(list_id)
123
+ Subscriber.is_subscribed?(@emailAddress, list_id, :apiKey=> @apiKey)
124
+ end
125
+
126
+ #Returns True or False as to the existence of the given email address in the list supplied.
127
+ #
128
+ #Aviable _opts_ arguments are:
129
+ # * :apiKey - optional API key to use to make request. Will use CAMPAIGN_MONITOR_API_KEY if not set.
130
+ def self.is_subscribed?(email, list_id, opts={})
131
+ response = @@soap.getIsSubscribed(
132
+ :apiKey => opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY,
133
+ :listID => list_id,
134
+ :email => email
135
+ )
136
+ response = handle_response response.subscribers_GetIsSubscribedResult
137
+ response == 'True' ? true : false
138
+ end
139
+
140
+
141
+ protected
142
+
143
+ def custom_fields_array(custom_fields) #:nodoc:
144
+ arr = []
145
+ custom_fields.each do |key, value|
146
+ if value.is_a? Array
147
+ value.each do |v|
148
+ arr << {:key => key, :value => v}
149
+ end
150
+ else
151
+ arr << { :key => key, :value => value }
152
+ end
153
+ end
154
+ arr
155
+ end
156
+
157
+ end
158
+ end
@@ -0,0 +1,124 @@
1
+ # Template is defined in soap/default.rb which is automatically generated.
2
+ # In this file we add additional methods to the Template class.
3
+ require File.expand_path(File.dirname(__FILE__)) + '/module_mixin'
4
+
5
+
6
+ module Campaigning
7
+ class Template
8
+ include ModuleMixin
9
+ attr_accessor :templateID
10
+ attr_accessor :name
11
+ attr_accessor :previewURL
12
+ attr_accessor :screenshotURL
13
+
14
+ def initialize(templateID = nil, name = nil, previewURL = nil, screenshotURL = nil, opts = {})
15
+ @apiKey = opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY
16
+ @templateID = templateID
17
+ @name = name
18
+ @previewURL = previewURL
19
+ @screenshotURL = screenshotURL
20
+ end
21
+
22
+ #Creates a new template for a client.
23
+ #
24
+ #Available _params_ argument are:
25
+ # * :clientID - The ID of the client who will owner of the list.
26
+ # * :templateName - The name of the template. Maximum of 30 characters (will be truncated to 30 characters if longer).
27
+ # * :htmlPageURL - The URL of the HTML page you have created for the template.
28
+ # * :zipFileURL - Optional URL of a zip file containing any other files required by the template.
29
+ # * :screenshotURL - Optional URL of a screenshot of the template. Must be in jpeg format and at least 218 pixels wide.
30
+ # * :apiKey - optional API key to use to make request. Will use CAMPAIGN_MONITOR_API_KEY if not set.
31
+ #*Return*:
32
+ #
33
+ #*Success*: Upon a successful call, this method will return a Campaigning::Template object representing the newly created
34
+ #template. The object returned isn't filled with previewURL and screenShotURL once the CampaignMonitor API generate a new
35
+ #value for that and doesn't return it on te create! method. In order to get a complete filled object call the Template.details
36
+ #method.
37
+ #
38
+ #*Error*: An Exception containing the cause of the error will be raised.
39
+ def self.create!(params)
40
+ response = @@soap.createTemplate(
41
+ :apiKey => params[:apiKey] || CAMPAIGN_MONITOR_API_KEY,
42
+ :clientID => params[:clientID],
43
+ :templateName => params[:templateName],
44
+ :hTMLPageURL => params[:htmlPageURL],
45
+ :zipFileURL => params[:zipFileURL],
46
+ :screenshotURL => params[:screenshotURL]
47
+ )
48
+ Template.new( handle_response(response.template_CreateResult), params[:templateName], nil, nil, :apiKey=> params[:apiKey] )
49
+ end
50
+
51
+ #Gets the details of a template.
52
+ #
53
+ #*Return*:
54
+ #
55
+ #*Success*: Upon a successful call, this method will return a Template object, which consists of the template ID,
56
+ #the template name, a preview URL and a screenshot URL.
57
+ #
58
+ #*Error*: An Exception containing the cause of the error will be raised.
59
+ def details
60
+ response = @@soap.getTemplateDetail(:apiKey => @apiKey, :templateID => @templateID)
61
+ handle_response response.template_GetDetailResult
62
+ end
63
+
64
+ #Updates an existing template.
65
+ #
66
+ #Available _params_ argument are:
67
+ # * :templateID - The ID of the template to be updated.
68
+ # * :templateName - The name of the template. Maximum of 30 characters (will be truncated to 30 characters if longer).
69
+ # * :htmlPageURL - The URL of the HTML page you have created for the template.
70
+ # * :zipFileURL - Optional URL of a zip file containing any other files required by the template.
71
+ # * :screenshotURL - Optional URL of a screenshot of the template. Must be in jpeg format and at least 218 pixels wide.
72
+ # * :apiKey - optional API key to use to make request. Will use CAMPAIGN_MONITOR_API_KEY if not set.
73
+ #*Return*:
74
+ #
75
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
76
+ #containing a successful message.
77
+ #
78
+ #*Error*: An Exception containing the cause of the error will be raised.
79
+ def update!(params)
80
+ response = @@soap.updateTemplate(
81
+ :apiKey => params[:apiKey] || CAMPAIGN_MONITOR_API_KEY,
82
+ :templateID => @templateID,
83
+ :templateName => params[:templateName],
84
+ :hTMLPageURL => params[:htmlPageURL],
85
+ :zipFileURL => params[:zipFileURL],
86
+ :screenshotURL => params[:screenshotURL]
87
+ )
88
+ handle_response response.template_UpdateResult
89
+ end
90
+
91
+
92
+ #Deletes a template.
93
+ #
94
+ #*Return*:
95
+ #
96
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
97
+ #containing a successful message.
98
+ #
99
+ #*Error*: An Exception containing the cause of the error will be raised.
100
+ def delete!
101
+ response = Template.delete!(@templateID, :apiKey=> @apiKey)
102
+ self.templateID, self.name = nil, nil
103
+ response
104
+ end
105
+
106
+
107
+ #Deletes a template.
108
+ #
109
+ #Aviable _opts_ arguments are:
110
+ # * :apiKey - optional API key to use to make request. Will use CAMPAIGN_MONITOR_API_KEY if not set.
111
+ #
112
+ #*Return*:
113
+ #
114
+ #*Success*: Upon a successful call, this method will return a Campaigning::Result object wich consists of a +code+ and +message+ fields
115
+ #containing a successful message.
116
+ #
117
+ #*Error*: An Exception containing the cause of the error will be raised.
118
+ def self.delete!(template_id, opts={})
119
+ response = @@soap.deleteTemplate(:apiKey => opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY, :templateID => template_id)
120
+ handle_response response.template_DeleteResult
121
+ end
122
+
123
+ end
124
+ end
@@ -0,0 +1,116 @@
1
+ require 'rubygems'
2
+ require 'campaigning'
3
+
4
+ CAMPAIGN_MONITOR_API_KEY = '__PUT__YOUR__API__KEY__HERE__'
5
+
6
+
7
+ # SETUP FOR THIS SAMPLE ---------------------------------------------------------------------
8
+ #Creating a Client for this sample execution
9
+ client = Campaigning::Client.create!(
10
+ :companyName => "Client to Sample",
11
+ :contactName => "Marcus Cesar",
12
+ :emailAddress => "og3@example.com",
13
+ :country => "Ireland",
14
+ :timezone => "(GMT) Casablanca" #alternatively you can use "Campaigning.timezones" to get valid time zones list
15
+ )
16
+ puts "New Client created is: #{client.inspect}"
17
+ list = Campaigning::List.create!(
18
+ :clientID => client.clientID,
19
+ :title => "List from Sample Exec",
20
+ :unsubscribePage => "http://www.mycompany.com/campaign/ubsubscribe.html", #If not suplied or equals blank (""), default value will be used
21
+ :confirmOptIn => false,
22
+ :confirmationSuccessPage => "" #Default value will be used
23
+ )
24
+ # /SETUP FOR THIS SAMPLE ---------------------------------------------------------------------
25
+
26
+
27
+ # Here is how to create a campaign and send that campaign
28
+ client = Campaigning::Client.find_by_name("Client to Sample")
29
+ campaign = Campaigning::Campaign.create!(
30
+ :clientID => client.clientID,
31
+ :campaignName => "Campaign created for Campaign Sample",
32
+ :campaignSubject => "Campaign by myself - OK",
33
+ :fromName => "Mr. Gordon2",
34
+ :fromEmail => "gordon2@example.com",
35
+ :replyTo => "no-reply@example.com",
36
+ :htmlUrl => "http://www.mycompany.com/campaign_html",
37
+ :textUrl => "http://www.mycompany.com/campaign_text",
38
+ :subscriberListIDs => [list.listID],
39
+ :listSegments => client.segments
40
+ )
41
+ puts "New Campaign created is: #{campaign.inspect}"
42
+ #After create a campaign you can send as follow:
43
+ campaign.send!(
44
+ :confirmationEmail => "userhdhd@example.com",
45
+ :sendDate => DateTime.now #To send a campaign immediately pass in “Immediately”.
46
+ #This date should be in the users timezone and formatted as YYYY-MM-DD HH:MM:SS.
47
+ )
48
+
49
+
50
+ #Here is how to find a Campaign by subject.
51
+ #Return: It will return an Array of Campaign Objects
52
+ client = Campaigning::Client.find_by_name("Client to Sample")
53
+ campaigns = client.find_campaigns_by_subject("Campaign by myself - OK")
54
+ puts "Campaigns found are: #{campaigns.inspect}"
55
+
56
+
57
+ # Here is how to get all the bounces from a client Campaign
58
+ client = Campaigning::Client.find_by_name("Client to Sample")
59
+ client.campaigns.each do |campaign|
60
+ puts campaign.subject
61
+ puts campaign.bounces.inspect
62
+ end
63
+ # OR you could filter your campaigns by subject (Unortunately there is no way to get a campaign by his name, wich would be better):
64
+ client = Campaigning::Client.find_by_name("Client to Sample")
65
+ campaigns = client.find_campaigns_by_subject("Campaign by myself - OK")
66
+ puts "Bounces from a given campaign:"
67
+ campaigns.each do |campaign|
68
+ puts campaign.subject
69
+ puts campaign.bounces.inspect
70
+ end
71
+
72
+
73
+ #Here is how to get the Lists bellonging to a client Campaign
74
+ client = Campaigning::Client.find_by_name("Client to Sample")
75
+ campaigns = client.find_campaigns_by_subject("Campaign by myself - OK")
76
+ puts "Lists belonging to a given campaign: "
77
+ campaigns.each do |campaign|
78
+ puts campaign.subject
79
+ puts campaign.lists.inspect
80
+ end
81
+
82
+
83
+ #Here is how to get a list of all subscribers who opened a given campaign, and the number of times they opened the campaign
84
+ client = Campaigning::Client.find_by_name("Client One Company")
85
+ campaigns = client.find_campaigns_by_subject("Campaign by myself - OK")
86
+ subs_open = client.campaigns[0].opens
87
+ puts "Who opened a given campaign: #{subs_open.inspect}"
88
+
89
+
90
+
91
+ #Gets a list of all subscribers who clicked a link for a given campaign, the ID of the list they belong to,
92
+ #the links they clicked, and the number of times they clicked the link.
93
+ client = Campaigning::Client.find_by_name("Client to Sample")
94
+ subscriber_clicks = client.campaigns[0].subscriber_clicks
95
+ puts "Subscriber Clicks for a given campaign: #{subscriber_clicks.inspect}"
96
+
97
+
98
+ #Gets a statistical summary, including number of recipients and open count, for a given campaign.
99
+ client = Campaigning::Client.find_by_name("Client to Sample")
100
+ campaign = client.campaigns[1].summary
101
+ puts "Summary for a given campaign: #{campaign.inspect}"
102
+
103
+
104
+ #Gets a list of all subscribers who unsubscribed for a given campaign.
105
+ client = Campaigning::Client.find_by_name("Client to Sample")
106
+ campaign = client.campaigns[0].unsubscribes
107
+ puts "all subscribers who unsubscribed for a given campaign: #{campaign.inspect}"
108
+
109
+
110
+
111
+
112
+ # TEARDOWN FOR THIS SAMPLE --------------------------------------------------------------------
113
+ # Deleting a client created for this sample
114
+ client = Campaigning::Client.find_by_name("Client to Sample")
115
+ result = Campaigning::Client.delete!(client.clientID)
116
+ puts "Client deleted successfuly? #{result.message}"
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'campaigning'
3
+
4
+ CAMPAIGN_MONITOR_API_KEY = '__PUT__YOUR__API__KEY__HERE__'
5
+
6
+
7
+ #How to get a system Date from the API server
8
+ date_time = Campaigning.system_date
9
+
10
+ puts "API get the system date from the API server: #{date_time.inspect}"
11
+
12
+
13
+ #Here is how to set the debug mode for the SOAP requests
14
+ timezones = Campaigning.set_debug_mode! true
15
+ puts "API set debug mode to true"
16
+
17
+
18
+ #Here is how to get all the timezones
19
+ timezones = Campaigning.timezones
20
+ puts "All the timezones supported: #{timezones.inspect}"
21
+
22
+
23
+ #Here is how to get all countries supported by the API
24
+ countries = Campaigning.countries
25
+ puts "All supported countries: #{countries.inspect}"
@@ -0,0 +1,139 @@
1
+ require 'rubygems'
2
+ require 'campaigning'
3
+
4
+ CAMPAIGN_MONITOR_API_KEY = '__PUT__YOUR__API__KEY__HERE__'
5
+
6
+
7
+ # Here is how to get a list of all clients...
8
+ clients = Campaigning::Client.get_all_clients
9
+ puts "All my clients: #{clients.inspect}"
10
+
11
+
12
+ # Here is how to create a new client
13
+ client = Campaigning::Client.create!(
14
+ :companyName => "Company to Sample Client",
15
+ :contactName => "Oswald Green Sample",
16
+ :emailAddress => "og233@example.com",
17
+ :country => "Ireland",
18
+ :timezone => "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London" #alternatively you can use "Campaigning.timezones" to get valid time zones list
19
+ )
20
+ puts "New Client created is: #{client.inspect}"
21
+
22
+ client_two = Campaigning::Client.create!(
23
+ :companyName => "Company Gordon",
24
+ :contactName => "Mr. Gordon",
25
+ :emailAddress => "gordon3@example.com",
26
+ :country => "Ireland",
27
+ :timezone => "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London" #alternatively you can use "Campaigning.timezones" to get valid time zones list
28
+ )
29
+ puts "Other new Client created is: #{client_two.inspect}"
30
+
31
+
32
+
33
+ # SETUP FOR THIS SAMPLE ---------------------------------------------------------------------
34
+ #Creating a list for this sample execution
35
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
36
+ list = Campaigning::List.create!(
37
+ :clientID => client.clientID,
38
+ :title => "List people from Chicago",
39
+ :confirmOptIn => false
40
+ )
41
+ # /SETUP FOR THIS SAMPLE ---------------------------------------------------------------------
42
+
43
+
44
+ #How to find a client by his name
45
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
46
+ puts "Client retrieved by his name: #{client.inspect}"
47
+
48
+
49
+ #How to get all Lists belonging to a client
50
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
51
+ lists = client.lists
52
+ puts "Lists belonging to the client: #{lists.inspect}"
53
+
54
+
55
+ #How to get a List by it's name and belonging to a client
56
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
57
+ list = client.find_list_by_name("List people from Chicago")
58
+ puts "Lists belonging by his name: #{lists.inspect}"
59
+
60
+
61
+ #How to get a list of all campaigns that have been sent for a client.
62
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
63
+ campaigns = client.campaigns
64
+ puts "Campaigns that have been sent for a client: #{campaigns.inspect}"
65
+
66
+
67
+ #How to get a list of all subscriber segments for a client.
68
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
69
+ puts "All subscriber segments for a client: #{client.segments.inspect}"
70
+
71
+
72
+ #How to get all subscribers in the client-wide suppression list.
73
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
74
+ puts "Client suppression list: #{client.suppression_list}"
75
+
76
+
77
+ #How to update the access and billing settings of an existing client, leaving the basic details untouched.
78
+ #Consult the API website for more information: http://www.campaignmonitor.com/api/method/client-updateaccessandbilling/
79
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
80
+ response = client.update_access_and_billing!(
81
+ :accessLevel => 5 ,
82
+ :username => "client_comp_s",
83
+ :password => "1234560",
84
+ :billingType => "UserPaysOnClientsBehalf",
85
+ :currency => "USD",
86
+ :deliveryFee => 6.5,
87
+ :costPerRecipient => 1.5 ,
88
+ :designAndSpamTestFee => 5
89
+ )
90
+ puts "Was the Client successfuly updated?: #{response.message}"
91
+
92
+
93
+ #How to get the complete account and billing details for a particular client.
94
+ client = Campaigning::Client.find_by_name("Company to Sample Client")
95
+ #puts "Client details: #{client.details.inspect}"
96
+ puts "Client details: "
97
+ client_details = client.details
98
+ basic_details = client_details.basicDetails
99
+ access_and_billing_details = client_details.accessAndBilling
100
+ puts "Basic details:"
101
+ puts "Client ID: #{basic_details.clientID}\n
102
+ Company: #{basic_details.companyName}\n
103
+ Contact: #{basic_details.contactName}\n
104
+ Country: #{basic_details.country}\n
105
+ Timezone: #{basic_details.timezone}"
106
+
107
+ puts "Access and Billing Details:"
108
+ puts "Username: #{access_and_billing_details.username}\n
109
+ Password: #{access_and_billing_details.password}\n
110
+ Billing Type: #{access_and_billing_details.billingType}\n
111
+ Currency: #{access_and_billing_details.currency}\n
112
+ Delivery Fee: #{access_and_billing_details.deliveryFee}\n
113
+ Cost per Recipient: #{access_and_billing_details.costPerRecipient}\n
114
+ Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee}\n
115
+ Access Level: #{access_and_billing_details.accessLevel}"
116
+
117
+
118
+
119
+ #How to update the basic details of an existing client.
120
+ #Please note that the client’s existing access and billing details will remain unchanged by a call to Client.update_basics!.
121
+ client_two = Campaigning::Client.find_by_name("Company Gordon")
122
+ response = client.update_basics!(
123
+ :companyName => "My new Company",
124
+ :contactName => "Mr. Gordon Newman",
125
+ :emailAddress => "gordon-newman43@example.com",
126
+ :country => "Ireland",
127
+ :timezone => "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London"
128
+ )
129
+ puts "Was the other Client successfuly updated?: #{response.message}"
130
+
131
+
132
+ # Here is how to delete a client
133
+ result = Campaigning::Client.delete!(client.clientID)
134
+ puts "Client deleted successfuly? #{result.message}"
135
+ #Or you can use a instance method like:
136
+ client = Campaigning::Client.find_by_name("My new Company")
137
+ result = client.delete!
138
+ puts "Client two deleted successfuly? #{result.message}"
139
+