gnumarcelo-campaigning 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -9,7 +9,7 @@ This gem requires the following gems
9
9
 
10
10
  Soap4r (1.5.8)
11
11
 
12
- Jeweler
12
+ Jeweler (http://technicalpickles.com/posts/craft-the-perfect-gem-with-jeweler)
13
13
 
14
14
 
15
15
  == Copyright
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 6
3
+ :minor: 7
4
4
  :patch: 0
@@ -1,43 +1,43 @@
1
1
  gem "soap4r", "~> 1.5.0"
2
- require File.expand_path(File.dirname(__FILE__)) + '/soap/defaultDriver.rb'
2
+ require File.expand_path(File.dirname(__FILE__)) + '/soap/soap_driver.rb'
3
3
  require File.expand_path(File.dirname(__FILE__)) + '/types/client.rb'
4
4
  require File.expand_path(File.dirname(__FILE__)) + '/types/campaign.rb'
5
5
  require File.expand_path(File.dirname(__FILE__)) + '/types/subscriber.rb'
6
6
  require File.expand_path(File.dirname(__FILE__)) + '/types/list.rb'
7
7
  require File.expand_path(File.dirname(__FILE__)) + '/helpers/helpers.rb'
8
8
 
9
- class Connection
9
+ module Campaigning
10
+ class Base
10
11
  include Helpers
11
- DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
12
12
  attr_reader :api_key
13
- attr_reader :soap
14
13
 
15
- def initialize(api_key=CAMPAIGN_MONITOR_API_KEY)
16
- @api_key = api_key
17
- @soap = Campaigning::ApiSoap.new(DefaultEndpointUrl)
18
- setup_debug_mode true
14
+ def initialize(options = {})
15
+ options = {
16
+ :api_key => CAMPAIGN_MONITOR_API_KEY,
17
+ :debug => false
18
+ }.merge(options)
19
+ @api_key = options[:api_key]
20
+ @soap = Campaigning::SOAPDriver.instance.get_driver
21
+ setup_debug_mode options[:debug]
19
22
  end
20
23
 
21
24
  def clients
22
- response = soap.getClients(:apiKey => @api_key)
23
- handle_request response.user_GetClientsResult
25
+ response = @soap.getClients(:apiKey => @api_key)
26
+ clients = handle_request response.user_GetClientsResult
27
+ clients.collect {|client| Client.new(client.clientID, client.name)}
24
28
  end
25
29
 
26
30
  def system_date
27
- handle_request soap.getSystemDate(:apiKey => @api_key).user_GetSystemDateResult
31
+ handle_request @soap.getSystemDate(:apiKey => @api_key).user_GetSystemDateResult
28
32
  end
29
33
 
30
34
  def time_zones
31
- handle_request soap.getTimezones(:apiKey => @api_key).user_GetTimezonesResult
35
+ handle_request @soap.getTimezones(:apiKey => @api_key).user_GetTimezonesResult
32
36
  end
33
37
 
34
38
  def setup_debug_mode(dev)
35
- dev = STDERR if dev == true
36
- soap.wiredump_dev = dev
37
- end
38
-
39
- def endpoint_url(url)
40
- soap.endpoint_url = url
39
+ Campaigning::SOAPDriver.instance.setup_debug_mode dev
41
40
  end
42
41
 
43
42
  end
43
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + '/generated/defaultDriver.rb'
2
+ require 'singleton'
3
+
4
+ module Campaigning
5
+ class SOAPDriver #It could be a module
6
+ include Singleton
7
+ DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
8
+
9
+ def get_driver
10
+ @driver ||= Campaigning::ApiSoap.new(DefaultEndpointUrl)
11
+ end
12
+
13
+ def setup_debug_mode(dev)
14
+ dev = STDERR if dev == true
15
+ @driver.wiredump_dev = dev
16
+ end
17
+
18
+ end
19
+ end
@@ -17,11 +17,11 @@ module Campaigning
17
17
  @subject = subject
18
18
  @sentDate = sentDate
19
19
  @totalRecipients = totalRecipients
20
- @cm = Connection.new
20
+ @soap = Campaigning::SOAPDriver.instance.get_driver
21
21
  end
22
22
 
23
23
  def self.create(params)
24
- response = Connection.new.soap.createCampaign(
24
+ response = Campaigning::SOAPDriver.instance.get_driver.createCampaign(
25
25
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
26
26
  :clientID => params[:clientID],
27
27
  :campaignName => params[:campaignName],
@@ -40,37 +40,37 @@ module Campaigning
40
40
  end
41
41
 
42
42
  def bounces
43
- response = @cm.soap.getCampaignBounces(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
43
+ response = @soap.getCampaignBounces(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
44
44
  handle_request response.campaign_GetBouncesResult
45
45
  end
46
46
 
47
47
  def lists
48
- response = @cm.soap.getCampaignLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
48
+ response = @soap.getCampaignLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
49
49
  handle_request response.campaign_GetListsResult
50
50
  end
51
51
 
52
52
  def opens
53
- response = @cm.soap.getCampaignOpens(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
53
+ response = @soap.getCampaignOpens(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
54
54
  handle_request response.campaign_GetOpensResult
55
55
  end
56
56
 
57
57
  def subscriber_clicks
58
- response = @cm.soap.getSubscriberClicks(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
58
+ response = @soap.getSubscriberClicks(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
59
59
  handle_request response.campaign_GetSubscriberClicksResult
60
60
  end
61
61
 
62
62
  def summary
63
- response = @cm.soap.getCampaignSummary(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
63
+ response = @soap.getCampaignSummary(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
64
64
  handle_request response.campaign_GetSummaryResult
65
65
  end
66
66
 
67
67
  def unsubscribes
68
- response = @cm.soap.getCampaignUnsubscribes(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
68
+ response = @soap.getCampaignUnsubscribes(:apiKey => CAMPAIGN_MONITOR_API_KEY, :campaignID => @campaignID )
69
69
  handle_request response.campaign_GetUnsubscribesResult
70
70
  end
71
71
 
72
72
  def send(params)
73
- response = @cm.soap.sendCampaign(
73
+ response = @soap.sendCampaign(
74
74
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
75
75
  :campaignID => @campaignID,
76
76
  :confirmationEmail => params[:confirmation_email],
@@ -10,28 +10,14 @@ class Client
10
10
  attr_accessor :name
11
11
 
12
12
  def initialize(clientID = nil, name = nil)
13
- @cm = Connection.new
14
13
  @clientID = clientID
15
14
  @name = name
15
+ #@cm = Campaigning::Base.new
16
+ @soap = Campaigning::SOAPDriver.instance.get_driver
16
17
  end
17
18
 
18
-
19
- # def create
20
- # hash = {
21
- # :companyName => @company_name,
22
- # :contactName => @name,
23
- # :emailAddress => @email_address,
24
- # :country => @country,
25
- # :timezone => @time_zone
26
- # }
27
- #
28
- # generate a hash
29
- # send @cm.createClient request to campaign monitor
30
- # @clientID = response.client_CreateResult
31
- # end
32
-
33
19
  def lists
34
- response = @cm.soap.getClientLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID)
20
+ response = @soap.getClientLists(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID)
35
21
  lists = handle_request response.client_GetListsResult
36
22
  lists.collect {|list| List.new(list.listID, list.name)}
37
23
  end
@@ -43,13 +29,13 @@ class Client
43
29
  # TODO: Refactor this method and increase performance?
44
30
  # TODO: Tha campaign monitor permit two users with the same name, what to do?
45
31
  def self.find_by_name(name)
46
- client_list = Helpers.handle_request Connection.new.clients
32
+ client_list = Helpers.handle_request Campaigning::Base.new.clients
47
33
  client_found = client_list.find {|client| name == client.name}
48
34
  Client.new(client_found.clientID, client_found.name) if client_found
49
35
  end
50
36
 
51
37
  def self.create(params)
52
- response = Connection.new.soap.createClient(
38
+ response = Campaigning::SOAPDriver.instance.get_driver.createClient(
53
39
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
54
40
  :companyName => params[:company_name],
55
41
  :contactName => params[:contact_name],
@@ -57,7 +43,7 @@ class Client
57
43
  :country => params[:country],
58
44
  :timezone => params[:time_zone]
59
45
  )
60
- Client.new(Helpers.handle_request response.client_CreateResult)
46
+ Client.new( Helpers.handle_request(response.client_CreateResult) )
61
47
  end
62
48
 
63
49
  def delete
@@ -67,26 +53,25 @@ class Client
67
53
  end
68
54
 
69
55
  def self.delete(client_id)
70
- response = Connection.new.soap.deleteClient(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => client_id)
56
+ response = Campaigning::SOAPDriver.instance.get_driver.deleteClient(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => client_id)
71
57
  Helpers.handle_request response.client_DeleteResult
72
58
  end
73
59
 
74
60
  def segments
75
- response = @cm.soap.getClientSegments(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
61
+ response = @soap.getClientSegments(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
76
62
  handle_request response.client_GetSegmentsResult
77
63
  end
78
64
 
79
65
  # TODO: Refactor this method
80
- def find_campaigns_by_subject(subject, params=nil)
66
+ def find_campaigns_by_subject(subject)
81
67
  arr = []
82
- return campaigns.find {|campaign| subject == campaign.subject} if params[:unique]
83
-
68
+ #return campaigns.find {|campaign| subject == campaign.subject} if params[:single]
84
69
  campaigns.each { |campaign| arr << campaign if campaign.subject == subject }
85
70
  arr
86
71
  end
87
72
 
88
73
  def campaigns
89
- response = @cm.soap.getClientCampaigns(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
74
+ response = @soap.getClientCampaigns(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
90
75
  campaign_list = handle_request response.client_GetCampaignsResult
91
76
  campaign_list.collect do |campaign|
92
77
  Campaign.new(campaign.campaignID, campaign.subject, campaign.sentDate, campaign.totalRecipients)
@@ -94,17 +79,17 @@ class Client
94
79
  end
95
80
 
96
81
  def details
97
- response = @cm.soap.getClientDetail(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
82
+ response = @soap.getClientDetail(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
98
83
  handle_request response.client_GetDetailResult
99
84
  end
100
85
 
101
86
  def suppression_list
102
- response = @cm.soap.getClientSuppressionList(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
87
+ response = @soap.getClientSuppressionList(:apiKey => CAMPAIGN_MONITOR_API_KEY, :clientID => @clientID )
103
88
  handle_request response.client_GetSuppressionListResult
104
89
  end
105
90
 
106
91
  def update_access_and_billing(params)
107
- response = @cm.soap.updateClientAccessAndBilling(
92
+ response = @soap.updateClientAccessAndBilling(
108
93
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
109
94
  :clientID => @clientID,
110
95
  :accessLevel => params[:access_level],
@@ -120,7 +105,7 @@ class Client
120
105
  end
121
106
 
122
107
  def update_basics(params)
123
- response = @cm.soap.updateClientBasics(
108
+ response = @soap.updateClientBasics(
124
109
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
125
110
  :clientID => @clientID,
126
111
  :companyName => params[:company_name],
@@ -13,31 +13,29 @@ module Campaigning
13
13
  def initialize(listID = nil, name = nil)
14
14
  @listID = listID
15
15
  @name = name
16
- @cm = Connection.new
16
+ @soap = Campaigning::SOAPDriver.instance.get_driver
17
17
  end
18
18
 
19
19
  def self.create(params)
20
- params = {:unsubscribe_page => "", :confirmation_success_page => ""}.merge! params
21
- response = Connection.new.soap.createList(
20
+ response = Campaigning::SOAPDriver.instance.get_driver.createList(
22
21
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
23
22
  :clientID => params[:client_id],
24
23
  :title => params[:title],
25
- :unsubscribePage => params[:unsubscribe_page],
24
+ :unsubscribePage => params.fetch(:unsubscribe_page, ""),
26
25
  :confirmOptIn => params[:comfirm_opt_in],
27
- :confirmationSuccessPage => params[:confirmation_success_page]
28
- )
26
+ :confirmationSuccessPage => params.fetch(:confirmation_success_page, "")
27
+ )
29
28
  new_list_id = Helpers.handle_request response.list_CreateResult
30
29
  List.new(new_list_id, params[:title])
31
30
  end
32
31
 
33
32
  def create_custom_field(params)
34
- params = {:options => ""}.merge! params
35
- response = @cm.soap.createListCustomField(
33
+ response = @soap.createListCustomField(
36
34
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
37
35
  :listID => @listID,
38
36
  :fieldName => params[:field_name],
39
37
  :dataType => params[:data_type],
40
- :options => params[:options]
38
+ :options => params.fetch(:options, "")
41
39
  )
42
40
  handle_request response.list_CreateCustomFieldResult
43
41
  end
@@ -48,35 +46,34 @@ module Campaigning
48
46
  end
49
47
 
50
48
  def self.delete(list_id)
51
- response = Connection.new.soap.deleteList(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => list_id)
49
+ response = Campaigning::SOAPDriver.instance.get_driver.deleteList(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => list_id)
52
50
  Helpers.handle_request response.list_DeleteResult
53
51
  end
54
52
 
55
53
  def delete_custom_field(key)
56
- response = @cm.soap.deleteListCustomField(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID, :key => '['+key+']')
54
+ response = @soap.deleteListCustomField(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID, :key => '['+key+']')
57
55
  handle_request response.list_DeleteCustomFieldResult
58
56
  end
59
57
 
60
58
  def custom_fields
61
- response = @cm.soap.getListCustomFields(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID)
59
+ response = @soap.getListCustomFields(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID)
62
60
  handle_request response.list_GetCustomFieldsResult
63
61
  end
64
62
 
65
63
  def details
66
- response = @cm.soap.getListDetail(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID)
64
+ response = @soap.getListDetail(:apiKey => CAMPAIGN_MONITOR_API_KEY, :listID => @listID)
67
65
  handle_request response.list_GetDetailResult
68
66
  end
69
67
 
70
68
 
71
69
  def update(params)
72
- params = {:unsubscribe_page => "", :confirmation_success_page => ""}.merge! params
73
- response = @cm.soap.updateList(
70
+ response = @soap.updateList(
74
71
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
75
72
  :listID => @listID,
76
73
  :title => params[:title],
77
- :unsubscribePage => params[:unsubscribe_page],
74
+ :unsubscribePage => params.fetch(:unsubscribe_page, ""),
78
75
  :confirmOptIn => params[:comfirm_opt_in],
79
- :confirmationSuccessPage => params[:confirmation_success_page]
76
+ :confirmationSuccessPage => params.fetch(:confirmation_success_page, "")
80
77
  )
81
78
  handle_request response.list_UpdateResult
82
79
  end
@@ -18,11 +18,11 @@ class Subscriber
18
18
  @date = date
19
19
  @state = state
20
20
  @customFields = customFields
21
- @cm = Connection.new
21
+ @soap = Campaigning::SOAPDriver.instance.get_driver
22
22
  end
23
23
 
24
24
  def add(list_id)
25
- response = @cm.soap.addSubscriber(
25
+ response = @soap.addSubscriber(
26
26
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
27
27
  :listID => list_id,
28
28
  :email => @emailAddress,
@@ -32,7 +32,7 @@ class Subscriber
32
32
  end
33
33
 
34
34
  def add_and_resubscribe(list_id)
35
- response = @cm.soap.addAndResubscribe(
35
+ response = @soap.addAndResubscribe(
36
36
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
37
37
  :listID => list_id,
38
38
  :email => @emailAddress,
@@ -42,18 +42,18 @@ class Subscriber
42
42
  end
43
43
 
44
44
  def add_and_resubscribe_with_custom_fields(list_id, custom_fields)
45
- response = @cm.soap.addAndResubscribeWithCustomFields(
45
+ response = @soap.addAndResubscribeWithCustomFields(
46
46
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
47
47
  :listID => list_id,
48
48
  :email => @emailAddress,
49
49
  :name => @name,
50
50
  :customFields => custom_fields_array(custom_fields)
51
51
  )
52
- Helpers.handle_request response.subscriber_AddAndResubscribeWithCustomFieldsResult
52
+ handle_request response.subscriber_AddAndResubscribeWithCustomFieldsResult
53
53
  end
54
54
 
55
55
  def add_with_custom_fields(list_id, custom_fields)
56
- response = @cm.soap.addSubscriberWithCustomFields(
56
+ response = @soap.addSubscriberWithCustomFields(
57
57
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
58
58
  :listID => list_id,
59
59
  :email => @emailAddress,
@@ -64,17 +64,21 @@ class Subscriber
64
64
  end
65
65
 
66
66
  def unsubscribe(list_id)
67
- response = @cm.soap.unsubscribe(
67
+ Subscriber.unsubscribe(@emailAddress, list_id)
68
+ end
69
+
70
+ def self.unsubscribe(email, list_id)
71
+ response = Campaigning::SOAPDriver.instance.get_driver.unsubscribe(
68
72
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
69
73
  :listID => list_id,
70
- :email => @emailAddress
74
+ :email => email
71
75
  )
72
- handle_request response.subscriber_UnsubscribeResult
76
+ Helpers.handle_request response.subscriber_UnsubscribeResult
73
77
  end
74
78
 
75
79
  # TODO: May I move this method to List type?
76
80
  def self.active_subscribers(list_id, datetime)
77
- response = Connection.new.soap.getSubscribers(
81
+ response = Campaigning::SOAPDriver.instance.get_driver.getSubscribers(
78
82
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
79
83
  :listID => list_id,
80
84
  :date => datetime.strftime('%Y-%m-%d %H:%M:%S') # TODO: Move that to a helper method
@@ -84,7 +88,7 @@ class Subscriber
84
88
 
85
89
  # TODO: May I move this method to List type?
86
90
  def self.get_unsubscribed(list_id, datetime)
87
- response = Connection.new.soap.getUnsubscribed(
91
+ response = Campaigning::SOAPDriver.instance.get_driver.getUnsubscribed(
88
92
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
89
93
  :listID => list_id,
90
94
  :date => datetime.strftime('%Y-%m-%d %H:%M:%S') # TODO: Move that to a helper method
@@ -93,18 +97,22 @@ class Subscriber
93
97
  end
94
98
 
95
99
  def is_subscribed?(list_id)
96
- response = @cm.soap.getIsSubscribed(
100
+ Subscriber.is_subscribed?(@emailAddress, list_id)
101
+ end
102
+
103
+ def self.is_subscribed?(email, list_id)
104
+ response = Campaigning::SOAPDriver.instance.get_driver.getIsSubscribed(
97
105
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
98
106
  :listID => list_id,
99
- :email => @emailAddress
107
+ :email => email
100
108
  )
101
- response = handle_request response.subscribers_GetIsSubscribedResult
109
+ response = Helpers.handle_request response.subscribers_GetIsSubscribedResult
102
110
  response == 'True' ? true : false
103
111
  end
104
112
 
105
113
  # TODO: Create a mehod to handle with custom fields returned like (names from "State Name" to "state_name")
106
114
  def self.get_single_subscriber(list_id, email_address)
107
- response = Connection.new.soap.getSingleSubscriber(
115
+ response = Campaigning::SOAPDriver.instance.get_driver.getSingleSubscriber(
108
116
  :apiKey => CAMPAIGN_MONITOR_API_KEY,
109
117
  :listID => list_id,
110
118
  :emailAddress => email_address
@@ -1,17 +1,16 @@
1
1
  require 'test_helper'
2
2
 
3
3
  # Replace this API key with your own (http://www.campaignmonitor.com/api/)
4
- CAMPAIGN_MONITOR_API_KEY = '54cae7f3aa1f35cb3bb5bc41756d8b7f'
4
+ CAMPAIGN_MONITOR_API_KEY = '__PUT__YOUR__API__KEY__HERE__'
5
5
  CLIENT_ID = 'd7acfd4cd2ffffc2d86b8903d18a1276'
6
6
  CLIENT_TWO_ID = '730acd1e8d27d56bdb87e88685613d72'
7
7
 
8
8
  class CampaigningTest < Test::Unit::TestCase
9
9
 
10
10
  def setup
11
- @cm = Connection.new
11
+ @cm = Campaigning::Base.new
12
12
  end
13
-
14
-
13
+
15
14
  # def test_clients
16
15
  # clients = @cm.clients
17
16
  # assert clients.length > 0
@@ -27,9 +26,9 @@ class CampaigningTest < Test::Unit::TestCase
27
26
  #
28
27
  # def test_client_create
29
28
  # client_created = Campaigning::Client.create(
30
- # :company_name => "Orange Company 14",
31
- # :contact_name => "Oswald Green11",
32
- # :email_address => "og1@user.com",
29
+ # :company_name => "Orange Company 15",
30
+ # :contact_name => "Oswald Green15",
31
+ # :email_address => "og15@user.com",
33
32
  # :country => "Ireland",
34
33
  # :time_zone => @cm.time_zones[1]
35
34
  # )
@@ -54,17 +53,18 @@ class CampaigningTest < Test::Unit::TestCase
54
53
  # end
55
54
  #
56
55
  #
57
- # def test_find_client_by_name
58
- # client = Campaigning::Client.find_by_name("Client One Company")
59
- # assert client != nil && client.name == "Client One Company"
60
- # end
56
+ def test_find_client_by_name
57
+ client = Campaigning::Client.find_by_name("Client One Company")
58
+ puts client.inspect
59
+ # assert client != nil && client.name == "Client One Company"
60
+ end
61
61
  #
62
62
  #
63
63
  # def test_get_client_campaigns
64
64
  # client = Campaigning::Client.find_by_name("Client One Company")
65
65
  # puts client.campaigns.inspect
66
66
  # end
67
- #
67
+
68
68
  # def test_get_client_details
69
69
  # client = Campaigning::Client.find_by_name("Client Two ")
70
70
  # puts client.details.inspect
@@ -122,8 +122,8 @@ class CampaigningTest < Test::Unit::TestCase
122
122
  # assert !sys_date.nil?
123
123
  # puts sys_date
124
124
  # end
125
-
126
-
125
+ #
126
+ #
127
127
  # def test_campaign_create
128
128
  # client = Campaigning::Client.find_by_name("Client One Company")
129
129
  # response = Campaigning::Campaign.create(
@@ -156,19 +156,13 @@ class CampaigningTest < Test::Unit::TestCase
156
156
  # client = Campaigning::Client.find_by_name("Client One Company")
157
157
  # puts client.campaigns[0].opens
158
158
  # end
159
-
159
+ #
160
160
  # def test_campaign_find_campaigns_by_subject
161
161
  # client = Campaigning::Client.find_by_name("Client One Company")
162
162
  # campaigns = client.find_campaigns_by_subject("Campaign to BOUNCE")
163
163
  # assert campaign.length > 0
164
164
  # end
165
-
166
- # def test_campaign_find_campaigns_by_subject_unique
167
- # client = Campaigning::Client.find_by_name("Client One Company")
168
- # campaign = client.find_campaigns_by_subject("Campaign to BOUNCE")
169
- # puts campaign.inspect
170
- # #assert campaign > 0
171
- # end
165
+ #
172
166
  #
173
167
  # def test_campaign_subscriber_clicks
174
168
  # client = Campaigning::Client.find_by_name("Client One Company")
@@ -206,7 +200,7 @@ class CampaigningTest < Test::Unit::TestCase
206
200
  # :send_date => "2009-04-30 11:55:01" # Date format YYYY-MM-DD HH:MM:SS.
207
201
  # )
208
202
  # end
209
- #
203
+
210
204
  # def test_subscriber_add
211
205
  # subscriber = Campaigning::Subscriber.new("robertf@test.com", "Robert Franklin")
212
206
  # response = subscriber.add("ac52b645c048888a44c87b5f1ecf6b7d")
@@ -218,8 +212,8 @@ class CampaigningTest < Test::Unit::TestCase
218
212
  # response = subscriber.add_and_resubscribe("ac52b645c048888a44c87b5f1ecf6b7d")
219
213
  # assert response.code == 0
220
214
  # end
221
- #
222
- #
215
+
216
+
223
217
  # def test_subscriber_add_and_resubscribe_with_custom_fields
224
218
  # subscriber = Campaigning::Subscriber.new("user_custon@test.com", "Mr. Custon")
225
219
  # response = subscriber.add_and_resubscribe_with_custom_fields("ac52b645c048888a44c87b5f1ecf6b7d", :CityName => "Dublin", :SponsorName => "Some Sponsor")
@@ -252,11 +246,11 @@ class CampaigningTest < Test::Unit::TestCase
252
246
  # assert response == false
253
247
  # end
254
248
  #
255
- def test_subscriber_get_single_subscriber
256
- subscriber = Campaigning::Subscriber.get_single_subscriber("ac52b645c048888a44c87b5f1ecf6b7d", "user_custon2@test.com")
257
- puts subscriber.inspect
258
- assert subscriber.name != nil
259
- end
249
+ # def test_subscriber_get_single_subscriber
250
+ # subscriber = Campaigning::Subscriber.get_single_subscriber("ac52b645c048888a44c87b5f1ecf6b7d", "user_custon2@test.com")
251
+ # puts subscriber.inspect
252
+ # assert subscriber.name != nil
253
+ # end
260
254
  #
261
255
  # def test_subscriber_get_unsubscribed
262
256
  # subscriber_list = Campaigning::Subscriber.get_unsubscribed("ac52b645c048888a44c87b5f1ecf6b7d", DateTime.new(y=2009,m=4,d=01, h=01,min=00,s=00))
@@ -269,7 +263,7 @@ class CampaigningTest < Test::Unit::TestCase
269
263
  # client = Campaigning::Client.find_by_name("Client One Company")
270
264
  # list = Campaigning::List.create(
271
265
  # :client_id => client.clientID,
272
- # :title => "My new list creater by ruby list.create",
266
+ # :title => "New list to test",
273
267
  # :unsubscribe_page => "",
274
268
  # :comfirm_opt_in => false,
275
269
  # :confirmation_success_page => ""
@@ -325,6 +319,6 @@ class CampaigningTest < Test::Unit::TestCase
325
319
  # )
326
320
  # assert result.code == 0
327
321
  # end
328
-
322
+
329
323
 
330
324
  end
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.6.0
4
+ version: 0.7.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-05-02 00:00:00 -07:00
12
+ date: 2009-05-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,9 +40,10 @@ files:
40
40
  - lib/campaigning.rb
41
41
  - lib/campaigning/campaigning.rb
42
42
  - lib/campaigning/helpers/helpers.rb
43
- - lib/campaigning/soap/default.rb
44
- - lib/campaigning/soap/defaultDriver.rb
45
- - lib/campaigning/soap/defaultMappingRegistry.rb
43
+ - lib/campaigning/soap/generated/default.rb
44
+ - lib/campaigning/soap/generated/defaultDriver.rb
45
+ - lib/campaigning/soap/generated/defaultMappingRegistry.rb
46
+ - lib/campaigning/soap/soap_driver.rb
46
47
  - lib/campaigning/types/campaign.rb
47
48
  - lib/campaigning/types/client.rb
48
49
  - lib/campaigning/types/list.rb