campaigning 0.15.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/.bnsignore +16 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +65 -0
- data/Rakefile +59 -0
- data/VERSION.yml +4 -0
- data/campaigning.gemspec +77 -0
- data/lib/campaigning.rb +1 -0
- data/lib/campaigning/campaign.rb +218 -0
- data/lib/campaigning/campaigning.rb +53 -0
- data/lib/campaigning/client.rb +335 -0
- data/lib/campaigning/list.rb +276 -0
- data/lib/campaigning/module_mixin.rb +31 -0
- data/lib/campaigning/soap/generated/default.rb +1715 -0
- data/lib/campaigning/soap/generated/defaultDriver.rb +413 -0
- data/lib/campaigning/soap/generated/defaultMappingRegistry.rb +1526 -0
- data/lib/campaigning/subscriber.rb +158 -0
- data/lib/campaigning/template.rb +124 -0
- data/sample/campaign_sample.rb +116 -0
- data/sample/campaigning_sample.rb +25 -0
- data/sample/client_sample.rb +139 -0
- data/sample/list_sample.rb +159 -0
- data/sample/subscriber_sample.rb +88 -0
- data/test/campaign_test.rb +102 -0
- data/test/campaigning_test.rb +34 -0
- data/test/client_test.rb +130 -0
- data/test/list_test.rb +113 -0
- data/test/subscriber_test.rb +55 -0
- data/test/template_test.rb +62 -0
- data/test/test_helper.rb +10 -0
- metadata +100 -0
data/test/list_test.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
# Replace this API key with your own (http://www.campaignmonitor.com/api/)
|
4
|
+
CAMPAIGN_MONITOR_API_KEY = '__PUT_YOUR_API_KEY_HERE__'
|
5
|
+
|
6
|
+
class ListTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
|
9
|
+
def setup
|
10
|
+
#Campaigning.set_endpoint_url "http://127.0.0.1:8088/mockapiSoap"
|
11
|
+
Campaigning.set_debug_mode(:on)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_list_stats
|
15
|
+
client = Campaigning::Client.find_by_name("Client One Company")
|
16
|
+
list = client.find_list_by_name "New list to test BLA"
|
17
|
+
puts list.stats.inspect
|
18
|
+
#assert subscriber_list.length > 0
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# def test_list_find_single_subscriber
|
23
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
24
|
+
# list = client.find_list_by_name "My Friends"
|
25
|
+
# subscriber = list.find_single_subscriber("user_custon2@test.com")
|
26
|
+
# puts subscriber.inspect
|
27
|
+
# assert subscriber.name != nil
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# def test_list_find_unsubscribed
|
31
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
32
|
+
# list = client.find_list_by_name "My Friends"
|
33
|
+
# subscriber_list = list.find_unsubscribed(DateTime.new(y=2009,m=4,d=01, h=01,min=00,s=00))
|
34
|
+
# puts subscriber_list.inspect
|
35
|
+
# assert subscriber_list.length > 0
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# def test_list_find_active_subscribers
|
39
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
40
|
+
# list = client.find_list_by_name "My Friends"
|
41
|
+
# subscriber_list = list.find_active_subscribers(DateTime.new(y=2009,m=5,d=01, h=01,min=00,s=00))
|
42
|
+
# assert subscriber_list.length > 0
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# def test_list_get_all_active_subscribers
|
46
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
47
|
+
# list = client.find_list_by_name "My Friends"
|
48
|
+
# subscriber_list = list.get_all_active_subscribers
|
49
|
+
# puts subscriber_list.inspect
|
50
|
+
# assert subscriber_list.length > 0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# def test_list_create
|
54
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
55
|
+
# list = Campaigning::List.create!(
|
56
|
+
# :clientID => client.clientID,
|
57
|
+
# :title => "New list to test",
|
58
|
+
# :unsubscribePage => "",
|
59
|
+
# :confirmOptIn => false,
|
60
|
+
# :confirmationSuccessPage => ""
|
61
|
+
# )
|
62
|
+
# assert list.listID != nil
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# def test_list_create_custom_field
|
66
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
67
|
+
# list = client.find_list_by_name "My Friends"
|
68
|
+
# result = list.create_custom_field!(
|
69
|
+
# :fieldName => "Country" ,
|
70
|
+
# :dataType => "MultiSelectOne",
|
71
|
+
# :options => %w[Brazil Ireland England]
|
72
|
+
# )
|
73
|
+
# assert result.code == 0
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# def test_list_delete
|
77
|
+
# result = Campaigning::List.delete!("916797045feddc92df10a4722f819771")
|
78
|
+
# puts result.inspect
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# def test_list_delete_custom_field
|
82
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
83
|
+
# list = client.find_list_by_name "My Friends"
|
84
|
+
# result = list.delete_custom_field!("Country")
|
85
|
+
# assert result.code == 0
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# def test_list_custom_fields
|
89
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
90
|
+
# list = client.find_list_by_name "My Friends"
|
91
|
+
# result = list.custom_fields
|
92
|
+
# puts result.inspect
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# def test_list_details
|
96
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
97
|
+
# list = client.find_list_by_name "My Friends"
|
98
|
+
# result = list.details
|
99
|
+
# puts result.inspect
|
100
|
+
# end
|
101
|
+
#
|
102
|
+
# def test_list_update
|
103
|
+
# client = Campaigning::Client.find_by_name("Client One Company")
|
104
|
+
# list = client.find_list_by_name "My Friends"
|
105
|
+
# result = list.update!(
|
106
|
+
# :title => "NEW TITLE : My new list created by ruby list.create",
|
107
|
+
# :unsubscribePage => "",
|
108
|
+
# :confirmOptIn => false,
|
109
|
+
# :confirmationSuccessPage => ""
|
110
|
+
# )
|
111
|
+
# assert result.code == 0
|
112
|
+
# end
|
113
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
# Replace this API key with your own (http://www.campaignmonitor.com/api/)
|
4
|
+
CAMPAIGN_MONITOR_API_KEY = '__PUT_YOUR_API_KEY_HERE__'
|
5
|
+
|
6
|
+
class SubscriberTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
|
9
|
+
def setup
|
10
|
+
#Campaigning.set_endpoint_url "http://127.0.0.1:8088/mockapiSoap"
|
11
|
+
Campaigning.set_debug_mode(:on)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_subscriber_add
|
15
|
+
subscriber = Campaigning::Subscriber.new("robertf@test.com", "Robert Franklin")
|
16
|
+
response = subscriber.add!("ac52b645c048888a44c87b5f1ecf6b7d")
|
17
|
+
assert response.code == 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_subscriber_add_with_custom_fields
|
21
|
+
subscriber = Campaigning::Subscriber.new("user_custon2@test.com", "Mr. Custon")
|
22
|
+
response = subscriber.add!("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "London", :SponsorName => "Some Sponsor from London")
|
23
|
+
assert response.code == 0
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_subscriber_add_and_resubscribe
|
27
|
+
subscriber = Campaigning::Subscriber.new("norag@test.com", "Nora Green")
|
28
|
+
response = subscriber.add_and_resubscribe!("ac52b645c048888a44c87b5f1ecf6b7d")
|
29
|
+
assert response.code == 0
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def test_subscriber_add_and_resubscribe_with_custom_fields
|
34
|
+
subscriber = Campaigning::Subscriber.new("user_custon@test.com", "Mr. Custon")
|
35
|
+
response = subscriber.add_and_resubscribe!("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "Dublin", :SponsorName => "Some Sponsor")
|
36
|
+
assert response.code == 0
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def test_subscriber_unsubscribe
|
41
|
+
subscriber = Campaigning::Subscriber.new("user_to_test@test.com") # TODO: Change to get the Subscriber, not to CREATE a new one
|
42
|
+
response = subscriber.unsubscribe!("ac52b645c048888a44c87b5f1ecf6b7d")
|
43
|
+
puts response.inspect
|
44
|
+
assert response.code == 0
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def test_subscriber_is_subscribed
|
49
|
+
subscriber = Campaigning::Subscriber.new("user_to_test@test.com") # TODO: Change to get the Subscriber, not to CREATE a new one
|
50
|
+
response = subscriber.is_subscribed?("ac52b645c048888a44c87b5f1ecf6b7d")
|
51
|
+
puts response.inspect
|
52
|
+
assert response == false
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
# Replace this API key with your own (http://www.campaignmonitor.com/api/)
|
4
|
+
CAMPAIGN_MONITOR_API_KEY = '__PUT_YOUR_API_KEY_HERE__'
|
5
|
+
HTML_PAGE_URL = "http://s4ve.as:80/pages/download/17767/template-with-editor-tags.html"
|
6
|
+
ZIP_FILE_URL = "http://s4ve.as:80/pages/download/17766/Archive.zip"
|
7
|
+
SCREENSHOT_URL = "http://s4ve.as:80/pages/download/17768/screenshot.png"
|
8
|
+
|
9
|
+
class TemplateTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
|
12
|
+
def setup
|
13
|
+
#Campaigning.set_endpoint_url "http://127.0.0.1:8088/mockapiSoap"
|
14
|
+
Campaigning.set_debug_mode(:on)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_create!
|
18
|
+
client = Campaigning::Client.get_all_clients.first
|
19
|
+
template_created = Campaigning::Template.create!(
|
20
|
+
:clientID => client.clientID,
|
21
|
+
:templateName => "template_BY_API",
|
22
|
+
:htmlPageURL => HTML_PAGE_URL,
|
23
|
+
:zipFileURL => ZIP_FILE_URL,
|
24
|
+
:screenshotURL => SCREENSHOT_URL
|
25
|
+
)
|
26
|
+
puts template_created.details
|
27
|
+
puts "\n INSPECT: #{template_created.inspect} \n"
|
28
|
+
assert !template_created.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
# #Should I return a new Template object?
|
32
|
+
# def test_details
|
33
|
+
# client = Campaigning::Client.get_all_clients.first
|
34
|
+
# template = client.templates.first
|
35
|
+
# assert !template.details.nil?
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# def test_update!
|
39
|
+
# client = Campaigning::Client.get_all_clients.first
|
40
|
+
# template = client.templates.first
|
41
|
+
# result = template.update!(
|
42
|
+
# :templateName => "template_BY_API-updt",
|
43
|
+
# :htmlPageURL => HTML_PAGE_URL,
|
44
|
+
# :zipFileURL => ZIP_FILE_URL,
|
45
|
+
# :screenshotURL => SCREENSHOT_URL
|
46
|
+
# )
|
47
|
+
# assert result.code == 0
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# def test_delete!
|
51
|
+
# client = Campaigning::Client.get_all_clients.first
|
52
|
+
# template = client.templates.last
|
53
|
+
# result = template.delete!
|
54
|
+
# assert result.code == 0
|
55
|
+
# assert template.templateID == nil
|
56
|
+
#
|
57
|
+
# #deleting template by templateID
|
58
|
+
# result = Campaigning::Template.delete!("d0814103dcee1073ef84516dd96a12c4")
|
59
|
+
# assert result.code == 0
|
60
|
+
# end
|
61
|
+
|
62
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: campaigning
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.15.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcelo Menezes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-30 00:00:00 +00:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: soap4r
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.5.0
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: gnumarcelo@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .bnsignore
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION.yml
|
41
|
+
- campaigning.gemspec
|
42
|
+
- lib/campaigning.rb
|
43
|
+
- lib/campaigning/campaign.rb
|
44
|
+
- lib/campaigning/campaigning.rb
|
45
|
+
- lib/campaigning/client.rb
|
46
|
+
- lib/campaigning/list.rb
|
47
|
+
- lib/campaigning/module_mixin.rb
|
48
|
+
- lib/campaigning/soap/generated/default.rb
|
49
|
+
- lib/campaigning/soap/generated/defaultDriver.rb
|
50
|
+
- lib/campaigning/soap/generated/defaultMappingRegistry.rb
|
51
|
+
- lib/campaigning/subscriber.rb
|
52
|
+
- lib/campaigning/template.rb
|
53
|
+
- sample/campaign_sample.rb
|
54
|
+
- sample/campaigning_sample.rb
|
55
|
+
- sample/client_sample.rb
|
56
|
+
- sample/list_sample.rb
|
57
|
+
- sample/subscriber_sample.rb
|
58
|
+
- test/campaign_test.rb
|
59
|
+
- test/campaigning_test.rb
|
60
|
+
- test/client_test.rb
|
61
|
+
- test/list_test.rb
|
62
|
+
- test/subscriber_test.rb
|
63
|
+
- test/template_test.rb
|
64
|
+
- test/test_helper.rb
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/gnumarcelo/campaigning
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --charset=UTF-8
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
version:
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: "0"
|
85
|
+
version:
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.3.5
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Interfaces with the campaign monitor api
|
93
|
+
test_files:
|
94
|
+
- test/campaign_test.rb
|
95
|
+
- test/campaigning_test.rb
|
96
|
+
- test/client_test.rb
|
97
|
+
- test/list_test.rb
|
98
|
+
- test/subscriber_test.rb
|
99
|
+
- test/template_test.rb
|
100
|
+
- test/test_helper.rb
|