patientslikeme-campaign_monitor 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/campaign_monitor.gemspec +1 -1
- data/lib/campaign_monitor.rb +13 -0
- data/lib/campaign_monitor/helpers.rb +0 -10
- data/lib/campaign_monitor/list.rb +4 -4
- metadata +1 -1
data/campaign_monitor.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'campaign_monitor'
|
4
|
-
s.version = "1.
|
4
|
+
s.version = "1.3.0"
|
5
5
|
s.summary = 'Provides access to the Campaign Monitor API.'
|
6
6
|
s.description = <<-EOF
|
7
7
|
A simple wrapper class that provides basic access to the Campaign Monitor API.
|
data/lib/campaign_monitor.rb
CHANGED
@@ -180,6 +180,13 @@ class CampaignMonitor
|
|
180
180
|
Result.new(Subscriber_Add("ListID" => list_id, "Email" => email, "Name" => name))
|
181
181
|
end
|
182
182
|
|
183
|
+
def using_soap
|
184
|
+
driver = wsdl_driver_factory.create_rpc_driver
|
185
|
+
response = yield(driver)
|
186
|
+
driver.reset_stream
|
187
|
+
|
188
|
+
response
|
189
|
+
end
|
183
190
|
|
184
191
|
# Encapsulates
|
185
192
|
class SubscriberBounce
|
@@ -224,6 +231,12 @@ class CampaignMonitor
|
|
224
231
|
end
|
225
232
|
end
|
226
233
|
|
234
|
+
protected
|
235
|
+
|
236
|
+
def wsdl_driver_factory
|
237
|
+
SOAP::WSDLDriverFactory.new("#{api_url}?WSDL")
|
238
|
+
end
|
239
|
+
|
227
240
|
end
|
228
241
|
|
229
242
|
# If libxml is installed, we use the FasterXmlSimple library, that provides most of the functionality of XmlSimple
|
@@ -13,16 +13,6 @@ class CampaignMonitor
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def wsdl_driver_factory
|
17
|
-
SOAP::WSDLDriverFactory.new("#{api_url}?WSDL")
|
18
|
-
end
|
19
|
-
|
20
|
-
def using_soap
|
21
|
-
driver = wsdl_driver_factory.create_rpc_driver
|
22
|
-
response = yield(driver)
|
23
|
-
driver.reset_stream
|
24
|
-
end
|
25
|
-
|
26
16
|
def timestamp_format
|
27
17
|
'%Y-%m-%d %H:%M:%S'
|
28
18
|
end
|
@@ -54,9 +54,9 @@ class CampaignMonitor
|
|
54
54
|
# name The subscriber's name.
|
55
55
|
# custom_fields A hash of field name => value pairs.
|
56
56
|
def add_subscriber_with_custom_fields(email, name, custom_fields)
|
57
|
-
response = using_soap do |driver|
|
57
|
+
response = cm_client.using_soap do |driver|
|
58
58
|
driver.addSubscriberWithCustomFields \
|
59
|
-
:ApiKey => api_key,
|
59
|
+
:ApiKey => cm_client.api_key,
|
60
60
|
:ListID => self.id,
|
61
61
|
:Email => email,
|
62
62
|
:Name => name,
|
@@ -70,9 +70,9 @@ class CampaignMonitor
|
|
70
70
|
# name The subscriber's name.
|
71
71
|
# custom_fields A hash of field name => value pairs.
|
72
72
|
def add_and_resubscribe_with_custom_fields(email, name, custom_fields)
|
73
|
-
response = using_soap do |driver|
|
73
|
+
response = cm_client.using_soap do |driver|
|
74
74
|
driver.addAndResubscribeWithCustomFields \
|
75
|
-
:ApiKey => api_key,
|
75
|
+
:ApiKey => cm_client.api_key,
|
76
76
|
:ListID => self.id,
|
77
77
|
:Email => email,
|
78
78
|
:Name => name,
|