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.
@@ -8,142 +8,142 @@ class CampaigningTest < Test::Unit::TestCase
8
8
 
9
9
  def setup
10
10
  #Campaigning.set_endpoint_url "http://127.0.0.1:8088/mockapiSoap"
11
- #Campaigning.setup_debug_mode(true)
11
+ Campaigning.set_debug_mode(:on)
12
12
  end
13
13
 
14
- def test_campaigning_system_date
15
- date = Campaigning.system_date
16
- assert !date.nil?
17
- end
18
-
19
- def test_user_get_timezones
20
- timezones = Campaigning.timezones
21
- assert !timezones.nil?
22
- end
23
-
24
- def test_user_countries
25
- countries = Campaigning.countries
26
- assert !countries.nil?
27
- end
28
-
29
- def test_client_get_all_clients
30
- clients = Campaigning::Client.get_all_clients
31
- assert clients.length > 0
32
- #clients.each{ |c| puts c.clientID + " - " + c.name }
33
- end
34
-
35
- def test_client_lists
36
- client = Campaigning::Client.find_by_name("Client One Company")
37
- assert client.lists.length > 0
38
- end
39
-
40
- #
41
- # def test_client_create
42
- # client_created = Campaigning::Client.create(
43
- # :companyName => "My test client",
44
- # :contactName => "Oswald Green15",
45
- # :emailAddress => "og15@user.com",
46
- # :country => "Ireland",
47
- # :timezone => Campaigning.timezones[1]
48
- # )
49
- # assert !client_created.clientID.nil?
50
- # end
14
+ # def test_campaigning_system_date
15
+ # date = Campaigning.system_date
16
+ # assert !date.nil?
17
+ # end
18
+ #
19
+ # def test_user_get_timezones
20
+ # timezones = Campaigning.timezones
21
+ # assert !timezones.nil?
22
+ # end
23
+ #
24
+ # def test_user_countries
25
+ # countries = Campaigning.countries
26
+ # assert !countries.nil?
27
+ # end
51
28
  #
29
+ # def test_client_get_all_clients
30
+ # clients = Campaigning::Client.get_all_clients
31
+ # assert clients.length > 0
32
+ # #clients.each{ |c| puts c.clientID + " - " + c.name }
33
+ # end
34
+ #
35
+ # def test_client_lists
36
+ # client = Campaigning::Client.find_by_name("Client One Company")
37
+ # assert client.lists.length > 0
38
+ # end
39
+
40
+
41
+ # def test_client_create!
42
+ # client_created = Campaigning::Client.create!(
43
+ # :companyName => "My test clients22",
44
+ # :contactName => "Oswald Green15s25",
45
+ # :emailAddress => "og1524s@example.com",
46
+ # :country => "Ireland",
47
+ # :timezone => Campaigning.timezones[1]
48
+ # )
49
+ # assert !client_created.clientID.nil?
50
+ # end
51
+ #
52
52
  # def test_client_delete
53
- # response = Campaigning::Client.delete(client_created.clientID)
53
+ # response = Campaigning::Client.delete!(client_created.clientID)
54
54
  # assert response.code == 0
55
55
  # end
56
56
  #
57
57
  # def test_client_delete_itself
58
58
  # client = Campaigning::Client.find_by_name("Orange Company 7")
59
- # client.delete
59
+ # client.delete!
60
60
  # end
61
61
 
62
- def test_client_segments
63
- client = Campaigning::Client.find_by_name("Client One Company")
64
- assert client.segments.length > 0
65
- end
66
-
67
-
68
- def test_find_client_by_name
69
- client = Campaigning::Client.find_by_name("Client One Company")
70
- assert !client.nil? && client.name == "Client One Company"
71
- end
72
-
73
-
74
- def test_get_client_campaigns
75
- client = Campaigning::Client.find_by_name("Client One Company")
76
- puts client.campaigns.inspect
77
- end
78
-
79
- def test_get_client_details
80
- client = Campaigning::Client.find_by_name("Client One Company")
81
- # client_details = client.details
82
- # basic_details = client_details.basicDetails
83
- # access_and_billing_details = client_details.accessAndBilling
84
- # puts "Basic details:"
85
- # puts "Client ID: #{basic_details.clientID} - \n
86
- # Company: #{basic_details.companyName} - \n
87
- # Contact: #{basic_details.contactName} - \n
88
- # Country: #{basic_details.country} - \n
89
- # Timezone: #{basic_details.timezone}"
90
- #
91
- # puts "Access and Billing Details:"
92
- # puts "Username: #{access_and_billing_details.username} - \n
93
- # Password: #{access_and_billing_details.password} - \n
94
- # Billing Type: #{access_and_billing_details.billingType} - \n
95
- # Currency: #{access_and_billing_details.currency} - \n
96
- # Delivery Fee: #{access_and_billing_details.deliveryFee} - \n
97
- # Cost per Recipient: #{access_and_billing_details.costPerRecipient} - \n
98
- # Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee} - \n
99
- # Access Level: #{access_and_billing_details.accessLevel}"
100
-
101
- assert !client.details.nil?
102
-
103
- end
104
-
105
- def test_get_client_suppression_list
106
- client = Campaigning::Client.find_by_name("Client One Company")
107
- puts client.suppression_list.inspect
108
- end
109
-
110
- def test_client_update_access_and_billing
111
- client = Campaigning::Client.find_by_name("Client One Company")
112
- response = client.update_access_and_billing(
113
- :accessLevel => 5 ,
114
- :username => "client_one",
115
- :password => "1234560",
116
- :billingType => "UserPaysOnClientsBehalf",
117
- :currency => "USD",
118
- :deliveryFee => 6.5,
119
- :costPerRecipient => 1.5 ,
120
- :designAndSpamTestFee => 5
121
- )
122
- assert response.code == 0
123
- end
124
-
125
- def test_client_update_basics
126
- client = Campaigning::Client.find_by_name("Client Two")
127
- response = client.update_basics(
128
- :companyName => "My new Company",
129
- :contactName => "Mr. Gordon Newman",
130
- :emailAddress => "gordon-newman@test.com",
131
- :country => "Ireland",
132
- :timezone => Campaigning.timezones[1]
133
- )
134
- assert response.code == 0
135
- end
136
-
137
- def test_client_find_list_by_name
138
- client = Campaigning::Client.find_by_name("Client One Company")
139
- list = client.find_list_by_name "My Friends"
140
- assert list.nil? == false
141
- end
62
+ # def test_client_segments
63
+ # client = Campaigning::Client.find_by_name("Client One Company")
64
+ # assert client.segments.length > 0
65
+ # end
66
+ #
67
+ #
68
+ # def test_find_client_by_name
69
+ # client = Campaigning::Client.find_by_name("Client One Company")
70
+ # assert !client.nil? && client.name == "Client One Company"
71
+ # end
72
+ #
73
+ #
74
+ # def test_get_client_campaigns
75
+ # client = Campaigning::Client.find_by_name("Client One Company")
76
+ # puts client.campaigns.inspect
77
+ # end
78
+ #
79
+ # def test_get_client_details
80
+ # client = Campaigning::Client.find_by_name("Client One Company")
81
+ # # client_details = client.details
82
+ # # basic_details = client_details.basicDetails
83
+ # # access_and_billing_details = client_details.accessAndBilling
84
+ # # puts "Basic details:"
85
+ # # puts "Client ID: #{basic_details.clientID} - \n
86
+ # # Company: #{basic_details.companyName} - \n
87
+ # # Contact: #{basic_details.contactName} - \n
88
+ # # Country: #{basic_details.country} - \n
89
+ # # Timezone: #{basic_details.timezone}"
90
+ # #
91
+ # # puts "Access and Billing Details:"
92
+ # # puts "Username: #{access_and_billing_details.username} - \n
93
+ # # Password: #{access_and_billing_details.password} - \n
94
+ # # Billing Type: #{access_and_billing_details.billingType} - \n
95
+ # # Currency: #{access_and_billing_details.currency} - \n
96
+ # # Delivery Fee: #{access_and_billing_details.deliveryFee} - \n
97
+ # # Cost per Recipient: #{access_and_billing_details.costPerRecipient} - \n
98
+ # # Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee} - \n
99
+ # # Access Level: #{access_and_billing_details.accessLevel}"
100
+ #
101
+ # assert !client.details.nil?
102
+ #
103
+ # end
104
+ #
105
+ # def test_get_client_suppression_list
106
+ # client = Campaigning::Client.find_by_name("Client One Company")
107
+ # puts client.suppression_list.inspect
108
+ # end
109
+ #
110
+ # # def test_client_update_access_and_billing!
111
+ # # client = Campaigning::Client.find_by_name("Client One Company")
112
+ # # response = client.update_access_and_billing!(
113
+ # # :accessLevel => 5 ,
114
+ # # :username => "client_one",
115
+ # # :password => "1234560",
116
+ # # :billingType => "UserPaysOnClientsBehalf",
117
+ # # :currency => "USD",
118
+ # # :deliveryFee => 6.5,
119
+ # # :costPerRecipient => 1.5 ,
120
+ # # :designAndSpamTestFee => 5
121
+ # # )
122
+ # # assert response.code == 0
123
+ # # end
124
+ # #
125
+ # # def test_client_update_basics!
126
+ # # client = Campaigning::Client.find_by_name("Client Two")
127
+ # # response = client.update_basics!(
128
+ # # :companyName => "My new Company",
129
+ # # :contactName => "Mr. Gordon Newman",
130
+ # # :emailAddress => "gordon-newman@test.com",
131
+ # # :country => "Ireland",
132
+ # # :timezone => Campaigning.timezones[1]
133
+ # # )
134
+ # # assert response.code == 0
135
+ # # end
136
+ #
137
+ # def test_client_find_list_by_name
138
+ # client = Campaigning::Client.find_by_name("Client One Company")
139
+ # list = client.find_list_by_name "My Friends"
140
+ # assert list.nil? == false
141
+ # end
142
142
 
143
143
 
144
144
  # def test_campaign_create
145
145
  # client = Campaigning::Client.find_by_name("Client One Company")
146
- # response = Campaigning::Campaign.create(
146
+ # response = Campaigning::Campaign.create!(
147
147
  # :clientID => client.clientID,
148
148
  # :campaignName => "Campaign by myself RUBY TO DELETE - CODEEEEE",
149
149
  # :campaignSubject => "Campaign by myself - OK - CODEEEEE",
@@ -205,7 +205,7 @@ class CampaigningTest < Test::Unit::TestCase
205
205
  #
206
206
  # def test_campaign_send
207
207
  # client = Campaigning::Client.find_by_name("Client One Company")
208
- # response = Campaigning::Campaign.create(
208
+ # response = Campaigning::Campaign.create!(
209
209
  # :clientID => client.clientID,
210
210
  # :campaignName => "Campaign by myself RUBY NEW CREATED",
211
211
  # :campaignSubject => "Campaign by myself - OK",
@@ -218,7 +218,7 @@ class CampaigningTest < Test::Unit::TestCase
218
218
  # :listSegments => client.segments
219
219
  # )
220
220
  #
221
- # puts client.campaigns[0].send(
221
+ # puts client.campaigns[0].send!(
222
222
  # :confirmationEmail => "userhdhd@test.com",
223
223
  # :sendDate => "2009-04-30 11:55:01" # Date format YYYY-MM-DD HH:MM:SS.
224
224
  # )
@@ -226,32 +226,34 @@ class CampaigningTest < Test::Unit::TestCase
226
226
  #
227
227
  # def test_subscriber_add
228
228
  # subscriber = Campaigning::Subscriber.new("robertf@test.com", "Robert Franklin")
229
- # response = subscriber.add("ac52b645c048888a44c87b5f1ecf6b7d")
230
- # assert response.code == 0
231
- # end
232
- #
233
- # def test_subscriber_add_and_resubscribe
234
- # subscriber = Campaigning::Subscriber.new("norag@test.com", "Nora Green")
235
- # response = subscriber.add_and_resubscribe("ac52b645c048888a44c87b5f1ecf6b7d")
236
- # assert response.code == 0
237
- # end
238
- #
239
- #
240
- # def test_subscriber_add_and_resubscribe_with_custom_fields
241
- # subscriber = Campaigning::Subscriber.new("user_custon@test.com", "Mr. Custon")
242
- # response = subscriber.add_and_resubscribe_with_custom_fields("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "Dublin", :SponsorName => "Some Sponsor")
229
+ # response = subscriber.add!("ac52b645c048888a44c87b5f1ecf6b7d")
243
230
  # assert response.code == 0
244
231
  # end
245
232
  #
246
233
  # def test_subscriber_add_with_custom_fields
247
234
  # subscriber = Campaigning::Subscriber.new("user_custon2@test.com", "Mr. Custon")
248
- # response = subscriber.add_with_custom_fields("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "London", :SponsorName => "Some Sponsor from London")
235
+ # response = subscriber.add!("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "London", :SponsorName => "Some Sponsor from London")
249
236
  # assert response.code == 0
250
237
  # end
238
+
239
+ def test_subscriber_add_and_resubscribe
240
+ subscriber = Campaigning::Subscriber.new("norag@test.com", "Nora Green")
241
+ response = subscriber.add_and_resubscribe!("ac52b645c048888a44c87b5f1ecf6b7d")
242
+ assert response.code == 0
243
+ end
244
+
245
+
246
+ def test_subscriber_add_and_resubscribe_with_custom_fields
247
+ subscriber = Campaigning::Subscriber.new("user_custon@test.com", "Mr. Custon")
248
+ response = subscriber.add_and_resubscribe!("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "Dublin", :SponsorName => "Some Sponsor")
249
+ assert response.code == 0
250
+ end
251
+
252
+
251
253
  #
252
254
  # def test_subscriber_unsubscribe
253
255
  # subscriber = Campaigning::Subscriber.new("user_to_test@test.com") # TODO: Change to get the Subscriber, not to CREATE a new one
254
- # response = subscriber.unsubscribe("ac52b645c048888a44c87b5f1ecf6b7d")
256
+ # response = subscriber.unsubscribe!("ac52b645c048888a44c87b5f1ecf6b7d")
255
257
  # puts response.inspect
256
258
  # assert response.code == 0
257
259
  # end
@@ -300,7 +302,7 @@ class CampaigningTest < Test::Unit::TestCase
300
302
  #
301
303
  # def test_list_create
302
304
  # client = Campaigning::Client.find_by_name("Client One Company")
303
- # list = Campaigning::List.create(
305
+ # list = Campaigning::List.create!(
304
306
  # :clientID => client.clientID,
305
307
  # :title => "New list to test",
306
308
  # :unsubscribePage => "",
@@ -313,7 +315,7 @@ class CampaigningTest < Test::Unit::TestCase
313
315
  # def test_list_create_custom_field
314
316
  # client = Campaigning::Client.find_by_name("Client One Company")
315
317
  # list = client.find_list_by_name "My Friends"
316
- # result = list.create_custom_field(
318
+ # result = list.create_custom_field!(
317
319
  # :fieldName => "Country" ,
318
320
  # :dataType => "MultiSelectOne",
319
321
  # :options => %w[Brazil Ireland England]
@@ -322,14 +324,14 @@ class CampaigningTest < Test::Unit::TestCase
322
324
  # end
323
325
  #
324
326
  # def test_list_delete
325
- # result = Campaigning::List.delete("916797045feddc92df10a4722f819771")
327
+ # result = Campaigning::List.delete!("916797045feddc92df10a4722f819771")
326
328
  # puts result.inspect
327
329
  # end
328
330
  #
329
331
  # def test_list_delete_custom_field
330
332
  # client = Campaigning::Client.find_by_name("Client One Company")
331
333
  # list = client.find_list_by_name "My Friends"
332
- # result = list.delete_custom_field("Country")
334
+ # result = list.delete_custom_field!("Country")
333
335
  # assert result.code == 0
334
336
  # end
335
337
  #
@@ -350,7 +352,7 @@ class CampaigningTest < Test::Unit::TestCase
350
352
  # def test_list_update
351
353
  # client = Campaigning::Client.find_by_name("Client One Company")
352
354
  # list = client.find_list_by_name "My Friends"
353
- # result = list.update(
355
+ # result = list.update!(
354
356
  # :title => "NEW TITLE : My new list created by ruby list.create",
355
357
  # :unsubscribePage => "",
356
358
  # :confirmOptIn => false,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnumarcelo-campaigning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Menezes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-18 00:00:00 -07:00
12
+ date: 2009-06-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,16 +37,15 @@ files:
37
37
  - Rakefile
38
38
  - VERSION.yml
39
39
  - lib/campaigning.rb
40
+ - lib/campaigning/campaign.rb
40
41
  - lib/campaigning/campaigning.rb
41
- - lib/campaigning/helpers/helpers.rb
42
+ - lib/campaigning/client.rb
43
+ - lib/campaigning/list.rb
44
+ - lib/campaigning/module_mixin.rb
42
45
  - lib/campaigning/soap/generated/default.rb
43
46
  - lib/campaigning/soap/generated/defaultDriver.rb
44
47
  - lib/campaigning/soap/generated/defaultMappingRegistry.rb
45
- - lib/campaigning/soap/soap_driver.rb
46
- - lib/campaigning/types/campaign.rb
47
- - lib/campaigning/types/client.rb
48
- - lib/campaigning/types/list.rb
49
- - lib/campaigning/types/subscriber.rb
48
+ - lib/campaigning/subscriber.rb
50
49
  - test/campaigning_test.rb
51
50
  - test/test_helper.rb
52
51
  has_rdoc: true
@@ -1,30 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__)) + '/generated/defaultDriver.rb'
2
- require 'singleton'
3
-
4
- module Campaigning
5
- #A SOAPDriver is a singleton object responsable to supply a way to interact with the SOAP::RPC::Driver object.
6
- class SOAPDriver #:nodoc:
7
- #It could be a module
8
- include Singleton
9
- DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
10
-
11
- #Return a unique Campaigning::SOAP::ApiSoap instance for the whole API client, which provides access to
12
- #all the Campaign Monitor API methods.
13
- def get_driver
14
- @driver ||= Campaigning::ApiSoap.new(DefaultEndpointUrl)
15
- end
16
-
17
- #This method turns the API debug mode to _on_ and _off_.
18
- #When method called with _true_ argument, it will switch to _on_ mode, the API will display at the console all
19
- #SOAP requests made to the API server.
20
- def setup_debug_mode(dev)
21
- dev = STDERR if dev == true
22
- get_driver
23
- @driver.wiredump_dev = dev
24
- end
25
-
26
- def set_endpoint_url(endpoint_url)
27
- @driver = Campaigning::ApiSoap.new(endpoint_url)
28
- end
29
- end
30
- end