gnumarcelo-campaigning 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  == THIS GEM IS UNDER DEVELOPMENT
3
2
 
4
3
  = campaigning
@@ -6,9 +5,12 @@
6
5
  This RubyGem provides access to the CampaignMonitor API(www.campaignmonitor.com/api) using SOAP.
7
6
 
8
7
  == Dependencies
9
- This gem requires the following gem's:
10
- -Soap4r (1.5.8)
11
- -Jeweler
8
+ This gem requires the following gems
9
+
10
+ Soap4r (1.5.8)
11
+
12
+ Jeweler
13
+
12
14
 
13
15
  == Copyright
14
16
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 1
2
+ :minor: 2
3
3
  :patch: 0
4
4
  :major: 0
data/lib/campaigning.rb CHANGED
@@ -1,59 +1 @@
1
- require 'soap/wsdlDriver'
2
- require 'net/http'
3
-
4
- require File.join(File.dirname(__FILE__), 'campaigning/client.rb')
5
-
6
- class Campaigning
7
-
8
- attr_reader :api_key, :api_url
9
-
10
- # Replace this API key with your own (http://www.campaignmonitor.com/api/)
11
- def initialize(api_key=CAMPAIGN_MONITOR_API_KEY)
12
- @api_key = api_key
13
- @api_url = 'http://api.createsend.com/api/api.asmx'
14
- end
15
-
16
-
17
- def clients
18
- response = soap do |driver|
19
- driver.GetClients(:ApiKey => @api_key)
20
- end
21
- #response.user_GetClientsResult.client.each{ |c| Client.new(c["ClientID"], c["Name"])}
22
- if(response.user_GetClientsResult.client.is_a?(Array))
23
- response.user_GetClientsResult.client.each{ |c| Client.new(c["ClientID"], c["Name"])}
24
- elsif !response.empty?
25
- [Client.new(response.user_GetClientsResult.client.clientID, response.user_GetClientsResult.client.name)]
26
- else
27
- []
28
- end
29
-
30
- end
31
-
32
-
33
- def lists(client_id)
34
- response = soap do |driver|
35
- driver.GetClientLists(:ApiKey => @api_key, :ClientID => client_id)
36
- end
37
- #response.client_GetListsResult.list.each{ |l| puts "quanto???"}
38
- if(response.client_GetListsResult.list.is_a?(Array))
39
- puts "retornou um monte de listas!"
40
- else
41
- puts "retornou soh uma lista"
42
- end
43
- end
44
-
45
-
46
- def soap
47
- driver = wsdl_driver_factory.create_rpc_driver
48
- response = yield(driver)
49
- driver.reset_stream
50
-
51
- response
52
- end
53
-
54
- protected
55
-
56
- def wsdl_driver_factory
57
- SOAP::WSDLDriverFactory.new("#{api_url}?wsdl")
58
- end
59
- end
1
+ require File.dirname(__FILE__) + '/campaigning/campaigning'
@@ -0,0 +1,65 @@
1
+ gem "soap4r", "~> 1.5.0"
2
+ require File.expand_path(File.dirname(__FILE__)) + '/soap/defaultDriver.rb'
3
+ require File.expand_path(File.dirname(__FILE__)) + '/types/client.rb'
4
+
5
+ class Campaigning
6
+ DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
7
+ attr_reader :api_key
8
+
9
+ #mattr_accessor :soap
10
+ #self.soap = ::ApiSoap.new(DefaultEndpointUrl)
11
+ # TODO: Consider change this to use something like "mattr_accessor" getter/setter methods at the class or module level.
12
+ @@soap = ::ApiSoap.new(DefaultEndpointUrl)
13
+ def soap
14
+ @@soap
15
+ end
16
+
17
+ # Replace this API key with your own (http://www.campaignmonitor.com/api/)
18
+ def initialize(api_key=CAMPAIGN_MONITOR_API_KEY)
19
+ @api_key = api_key
20
+ end
21
+
22
+
23
+ # Return a list of Clients
24
+ #
25
+ # Given an apiKey this method return a list of Clients for that user(apiKey).
26
+ #
27
+ # sample:
28
+ #
29
+ # cm = Campaigning.new(:apiKey => "54cae7f3aa1f35cb3bb5bc41756d8b7f")
30
+ # clients = cm.clients
31
+ # clients.each{ |c| puts c.clientID + " - " + c.name }
32
+ def clients
33
+ response = @@soap.getClients(:apiKey => @api_key)
34
+ handle_request response.user_GetClientsResult
35
+ end
36
+
37
+
38
+ def system_date
39
+ handle_request @@soap.getSystemDate(:apiKey => @api_key).user_GetSystemDateResult
40
+ end
41
+
42
+
43
+ def handle_request(response)
44
+ if (response.is_a? Result)
45
+ raise response.code.to_s + " - " + response.message
46
+ end
47
+ response
48
+ end
49
+
50
+
51
+ ##
52
+ # Sets the wiredump device the drivers.
53
+ def setup_debug_mode(dev)
54
+ if dev == true
55
+ dev = STDERR
56
+ end
57
+ @@soap.wiredump_dev = dev
58
+ end
59
+
60
+
61
+ def endpoint_url(url)
62
+ @@soap.endpoint_url = url
63
+ end
64
+
65
+ end
File without changes
@@ -0,0 +1,345 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + '/default.rb'
2
+ require File.expand_path(File.dirname(__FILE__)) + '/defaultMappingRegistry.rb'
3
+ require 'soap/rpc/driver'
4
+
5
+ class ApiSoap < ::SOAP::RPC::Driver
6
+ DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
7
+
8
+ Methods = [
9
+ [ "http://api.createsend.com/api/Subscriber.AddWithCustomFields",
10
+ "addSubscriberWithCustomFields",
11
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddWithCustomFields"]],
12
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddWithCustomFieldsResponse"]] ],
13
+ { :request_style => :document, :request_use => :literal,
14
+ :response_style => :document, :response_use => :literal,
15
+ :faults => {} }
16
+ ],
17
+ [ "http://api.createsend.com/api/Subscriber.AddAndResubscribeWithCustomFields",
18
+ "addAndResubscribeWithCustomFields",
19
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddAndResubscribeWithCustomFields"]],
20
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddAndResubscribeWithCustomFieldsResponse"]] ],
21
+ { :request_style => :document, :request_use => :literal,
22
+ :response_style => :document, :response_use => :literal,
23
+ :faults => {} }
24
+ ],
25
+ [ "http://api.createsend.com/api/Subscriber.Add",
26
+ "addSubscriber",
27
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.Add"]],
28
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddResponse"]] ],
29
+ { :request_style => :document, :request_use => :literal,
30
+ :response_style => :document, :response_use => :literal,
31
+ :faults => {} }
32
+ ],
33
+ [ "http://api.createsend.com/api/Subscriber.AddAndResubscribe",
34
+ "addAndResubscribe",
35
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddAndResubscribe"]],
36
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddAndResubscribeResponse"]] ],
37
+ { :request_style => :document, :request_use => :literal,
38
+ :response_style => :document, :response_use => :literal,
39
+ :faults => {} }
40
+ ],
41
+ [ "http://api.createsend.com/api/Subscriber.Unsubscribe",
42
+ "unsubscribe",
43
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.Unsubscribe"]],
44
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.UnsubscribeResponse"]] ],
45
+ { :request_style => :document, :request_use => :literal,
46
+ :response_style => :document, :response_use => :literal,
47
+ :faults => {} }
48
+ ],
49
+ [ "http://api.createsend.com/api/Subscribers.GetActive",
50
+ "getSubscribers",
51
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetActive"]],
52
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetActiveResponse"]] ],
53
+ { :request_style => :document, :request_use => :literal,
54
+ :response_style => :document, :response_use => :literal,
55
+ :faults => {} }
56
+ ],
57
+ [ "http://api.createsend.com/api/Subscribers.GetUnsubscribed",
58
+ "getUnsubscribed",
59
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetUnsubscribed"]],
60
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetUnsubscribedResponse"]] ],
61
+ { :request_style => :document, :request_use => :literal,
62
+ :response_style => :document, :response_use => :literal,
63
+ :faults => {} }
64
+ ],
65
+ [ "http://api.createsend.com/api/Subscribers.GetBounced",
66
+ "getBounced",
67
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetBounced"]],
68
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetBouncedResponse"]] ],
69
+ { :request_style => :document, :request_use => :literal,
70
+ :response_style => :document, :response_use => :literal,
71
+ :faults => {} }
72
+ ],
73
+ [ "http://api.createsend.com/api/Subscribers.GetSingleSubscriber",
74
+ "getSingleSubscriber",
75
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetSingleSubscriber"]],
76
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetSingleSubscriberResponse"]] ],
77
+ { :request_style => :document, :request_use => :literal,
78
+ :response_style => :document, :response_use => :literal,
79
+ :faults => {} }
80
+ ],
81
+ [ "http://api.createsend.com/api/Subscribers.GetIsSubscribed",
82
+ "getIsSubscribed",
83
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetIsSubscribed"]],
84
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscribers.GetIsSubscribedResponse"]] ],
85
+ { :request_style => :document, :request_use => :literal,
86
+ :response_style => :document, :response_use => :literal,
87
+ :faults => {} }
88
+ ],
89
+ [ "http://api.createsend.com/api/List.Create",
90
+ "createList",
91
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.Create"]],
92
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.CreateResponse"]] ],
93
+ { :request_style => :document, :request_use => :literal,
94
+ :response_style => :document, :response_use => :literal,
95
+ :faults => {} }
96
+ ],
97
+ [ "http://api.createsend.com/api/List.Update",
98
+ "updateList",
99
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.Update"]],
100
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.UpdateResponse"]] ],
101
+ { :request_style => :document, :request_use => :literal,
102
+ :response_style => :document, :response_use => :literal,
103
+ :faults => {} }
104
+ ],
105
+ [ "http://api.createsend.com/api/List.GetDetail",
106
+ "getListDetail",
107
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetDetail"]],
108
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetDetailResponse"]] ],
109
+ { :request_style => :document, :request_use => :literal,
110
+ :response_style => :document, :response_use => :literal,
111
+ :faults => {} }
112
+ ],
113
+ [ "http://api.createsend.com/api/List.Delete",
114
+ "deleteList",
115
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.Delete"]],
116
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.DeleteResponse"]] ],
117
+ { :request_style => :document, :request_use => :literal,
118
+ :response_style => :document, :response_use => :literal,
119
+ :faults => {} }
120
+ ],
121
+ [ "http://api.createsend.com/api/List.GetCustomFields",
122
+ "getListCustomFields",
123
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetCustomFields"]],
124
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetCustomFieldsResponse"]] ],
125
+ { :request_style => :document, :request_use => :literal,
126
+ :response_style => :document, :response_use => :literal,
127
+ :faults => {} }
128
+ ],
129
+ [ "http://api.createsend.com/api/List.DeleteCustomField",
130
+ "deleteListCustomField",
131
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.DeleteCustomField"]],
132
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.DeleteCustomFieldResponse"]] ],
133
+ { :request_style => :document, :request_use => :literal,
134
+ :response_style => :document, :response_use => :literal,
135
+ :faults => {} }
136
+ ],
137
+ [ "http://api.createsend.com/api/List.CreateCustomField",
138
+ "createListCustomField",
139
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.CreateCustomField"]],
140
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.CreateCustomFieldResponse"]] ],
141
+ { :request_style => :document, :request_use => :literal,
142
+ :response_style => :document, :response_use => :literal,
143
+ :faults => {} }
144
+ ],
145
+ [ "http://api.createsend.com/api/Client.GetCampaigns",
146
+ "getClientCampaigns",
147
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetCampaigns"]],
148
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetCampaignsResponse"]] ],
149
+ { :request_style => :document, :request_use => :literal,
150
+ :response_style => :document, :response_use => :literal,
151
+ :faults => {} }
152
+ ],
153
+ [ "http://api.createsend.com/api/Client.GetLists",
154
+ "getClientLists",
155
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetLists"]],
156
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetListsResponse"]] ],
157
+ { :request_style => :document, :request_use => :literal,
158
+ :response_style => :document, :response_use => :literal,
159
+ :faults => {} }
160
+ ],
161
+ [ "http://api.createsend.com/api/Client.GetSegments",
162
+ "getClientSegments",
163
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetSegments"]],
164
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetSegmentsResponse"]] ],
165
+ { :request_style => :document, :request_use => :literal,
166
+ :response_style => :document, :response_use => :literal,
167
+ :faults => {} }
168
+ ],
169
+ [ "http://api.createsend.com/api/Client.GetSuppressionList",
170
+ "getClientSuppressionList",
171
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetSuppressionList"]],
172
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetSuppressionListResponse"]] ],
173
+ { :request_style => :document, :request_use => :literal,
174
+ :response_style => :document, :response_use => :literal,
175
+ :faults => {} }
176
+ ],
177
+ [ "http://api.createsend.com/api/Client.Create",
178
+ "createClient",
179
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.Create"]],
180
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.CreateResponse"]] ],
181
+ { :request_style => :document, :request_use => :literal,
182
+ :response_style => :document, :response_use => :literal,
183
+ :faults => {} }
184
+ ],
185
+ [ "http://api.createsend.com/api/Client.UpdateBasics",
186
+ "updateClientBasics",
187
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.UpdateBasics"]],
188
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.UpdateBasicsResponse"]] ],
189
+ { :request_style => :document, :request_use => :literal,
190
+ :response_style => :document, :response_use => :literal,
191
+ :faults => {} }
192
+ ],
193
+ [ "http://api.createsend.com/api/Client.UpdateAccessAndBilling",
194
+ "updateClientAccessAndBilling",
195
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.UpdateAccessAndBilling"]],
196
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.UpdateAccessAndBillingResponse"]] ],
197
+ { :request_style => :document, :request_use => :literal,
198
+ :response_style => :document, :response_use => :literal,
199
+ :faults => {} }
200
+ ],
201
+ [ "http://api.createsend.com/api/Client.GetDetail",
202
+ "getClientDetail",
203
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetDetail"]],
204
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetDetailResponse"]] ],
205
+ { :request_style => :document, :request_use => :literal,
206
+ :response_style => :document, :response_use => :literal,
207
+ :faults => {} }
208
+ ],
209
+ [ "http://api.createsend.com/api/Client.Delete",
210
+ "deleteClient",
211
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.Delete"]],
212
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.DeleteResponse"]] ],
213
+ { :request_style => :document, :request_use => :literal,
214
+ :response_style => :document, :response_use => :literal,
215
+ :faults => {} }
216
+ ],
217
+ [ "http://api.createsend.com/api/Campaign.GetSubscriberClicks",
218
+ "getSubscriberClicks",
219
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetSubscriberClicks"]],
220
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetSubscriberClicksResponse"]] ],
221
+ { :request_style => :document, :request_use => :literal,
222
+ :response_style => :document, :response_use => :literal,
223
+ :faults => {} }
224
+ ],
225
+ [ "http://api.createsend.com/api/Campaign.GetOpens",
226
+ "getCampaignOpens",
227
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetOpens"]],
228
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetOpensResponse"]] ],
229
+ { :request_style => :document, :request_use => :literal,
230
+ :response_style => :document, :response_use => :literal,
231
+ :faults => {} }
232
+ ],
233
+ [ "http://api.createsend.com/api/Campaign.GetBounces",
234
+ "getCampaignBounces",
235
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetBounces"]],
236
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetBouncesResponse"]] ],
237
+ { :request_style => :document, :request_use => :literal,
238
+ :response_style => :document, :response_use => :literal,
239
+ :faults => {} }
240
+ ],
241
+ [ "http://api.createsend.com/api/Campaign.GetUnsubscribes",
242
+ "getCampaignUnsubscribes",
243
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetUnsubscribes"]],
244
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetUnsubscribesResponse"]] ],
245
+ { :request_style => :document, :request_use => :literal,
246
+ :response_style => :document, :response_use => :literal,
247
+ :faults => {} }
248
+ ],
249
+ [ "http://api.createsend.com/api/Campaign.GetSummary",
250
+ "getCampaignSummary",
251
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetSummary"]],
252
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetSummaryResponse"]] ],
253
+ { :request_style => :document, :request_use => :literal,
254
+ :response_style => :document, :response_use => :literal,
255
+ :faults => {} }
256
+ ],
257
+ [ "http://api.createsend.com/api/Campaign.GetLists",
258
+ "getCampaignLists",
259
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetLists"]],
260
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.GetListsResponse"]] ],
261
+ { :request_style => :document, :request_use => :literal,
262
+ :response_style => :document, :response_use => :literal,
263
+ :faults => {} }
264
+ ],
265
+ [ "http://api.createsend.com/api/User.GetClients",
266
+ "getClients",
267
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetClients"]],
268
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetClientsResponse"]] ],
269
+ { :request_style => :document, :request_use => :literal,
270
+ :response_style => :document, :response_use => :literal,
271
+ :faults => {} }
272
+ ],
273
+ [ "http://api.createsend.com/api/User.GetSystemDate",
274
+ "getSystemDate",
275
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetSystemDate"]],
276
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetSystemDateResponse"]] ],
277
+ { :request_style => :document, :request_use => :literal,
278
+ :response_style => :document, :response_use => :literal,
279
+ :faults => {} }
280
+ ],
281
+ [ "http://api.createsend.com/api/User.GetTimezones",
282
+ "getTimezones",
283
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetTimezones"]],
284
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetTimezonesResponse"]] ],
285
+ { :request_style => :document, :request_use => :literal,
286
+ :response_style => :document, :response_use => :literal,
287
+ :faults => {} }
288
+ ],
289
+ [ "http://api.createsend.com/api/User.GetCountries",
290
+ "getCountries",
291
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetCountries"]],
292
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetCountriesResponse"]] ],
293
+ { :request_style => :document, :request_use => :literal,
294
+ :response_style => :document, :response_use => :literal,
295
+ :faults => {} }
296
+ ],
297
+ [ "http://api.createsend.com/api/Campaign.Create",
298
+ "createCampaign",
299
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.Create"]],
300
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.CreateResponse"]] ],
301
+ { :request_style => :document, :request_use => :literal,
302
+ :response_style => :document, :response_use => :literal,
303
+ :faults => {} }
304
+ ],
305
+ [ "http://api.createsend.com/api/Campaign.Send",
306
+ "sendCampaign",
307
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.Send"]],
308
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Campaign.SendResponse"]] ],
309
+ { :request_style => :document, :request_use => :literal,
310
+ :response_style => :document, :response_use => :literal,
311
+ :faults => {} }
312
+ ]
313
+ ]
314
+
315
+ def initialize(endpoint_url = nil)
316
+ endpoint_url ||= DefaultEndpointUrl
317
+ super(endpoint_url, nil)
318
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
319
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
320
+ init_methods
321
+ end
322
+
323
+ private
324
+
325
+ def init_methods
326
+ Methods.each do |definitions|
327
+ opt = definitions.last
328
+ if opt[:request_style] == :document
329
+ add_document_operation(*definitions)
330
+ else
331
+ add_rpc_operation(*definitions)
332
+ qname = definitions[0]
333
+ name = definitions[2]
334
+ if qname.name != name and qname.name.capitalize == name.capitalize
335
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
336
+ __send__(name, *arg)
337
+ end
338
+ end
339
+ end
340
+ end
341
+ end
342
+ end
343
+
344
+
345
+