constantcontact 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/README.md +56 -1
  4. data/constantcontact.gemspec +1 -1
  5. data/lib/constantcontact/api.rb +111 -97
  6. data/lib/constantcontact/services/account_service.rb +20 -22
  7. data/lib/constantcontact/services/activity_service.rb +98 -100
  8. data/lib/constantcontact/services/base_service.rb +46 -44
  9. data/lib/constantcontact/services/campaign_schedule_service.rb +72 -74
  10. data/lib/constantcontact/services/campaign_tracking_service.rb +103 -105
  11. data/lib/constantcontact/services/contact_service.rb +73 -75
  12. data/lib/constantcontact/services/contact_tracking_service.rb +103 -105
  13. data/lib/constantcontact/services/email_marketing_service.rb +64 -66
  14. data/lib/constantcontact/services/event_spot_service.rb +356 -358
  15. data/lib/constantcontact/services/library_service.rb +228 -230
  16. data/lib/constantcontact/services/list_service.rb +55 -57
  17. data/lib/constantcontact/version.rb +1 -1
  18. data/spec/constantcontact/api_spec.rb +2 -4
  19. data/spec/constantcontact/services/account_service_spec.rb +3 -2
  20. data/spec/constantcontact/services/activity_service_spec.rb +10 -9
  21. data/spec/constantcontact/services/base_service_spec.rb +7 -5
  22. data/spec/constantcontact/services/campaign_schedule_service_spec.rb +7 -6
  23. data/spec/constantcontact/services/campaign_tracking_service_spec.rb +8 -7
  24. data/spec/constantcontact/services/contact_service_spec.rb +8 -7
  25. data/spec/constantcontact/services/contact_tracking_service_spec.rb +8 -7
  26. data/spec/constantcontact/services/email_marketing_spec.rb +7 -6
  27. data/spec/constantcontact/services/event_spot_spec.rb +28 -27
  28. data/spec/constantcontact/services/library_service_spec.rb +17 -16
  29. data/spec/constantcontact/services/list_service_spec.rb +6 -5
  30. metadata +20 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d714e82090d7e350380f30f2a87509ac4fe7c70
4
- data.tar.gz: 4bd41035480ac3bcdd4e071ef004a4bd5b871ef6
3
+ metadata.gz: b504d44d74f2915c947ea3417e57d22758255c11
4
+ data.tar.gz: 272bf4f65d880e5f406273074937b5af94e43394
5
5
  SHA512:
6
- metadata.gz: 09ca17d50a6168d25db59cca358d4834bc49e169481c6586c16cccbd2f05f2feea2b7b86d37700b84d10ca6d85d44904b561f2f23b5e45a5f4cf3700101b6514
7
- data.tar.gz: 834c9c4cdba87a990954cf82a389116310619a835f62ade7b1139556d240581acaa4e5a245ab8885f45475bf7794b6720fff8a4323c4d8fa964a8670efc642a0
6
+ metadata.gz: e91b1457401bac48b5d84304f997052f56e758e93d03ccc8e66da99285dc43b6e3c4f93e4cd91460589e90c4f5b92a82d7529fc98c6d26426e29844fed89182e
7
+ data.tar.gz: 3624f6b496abbecc35eeca6955078020dcb642e1d1cec0bc128f0dc0ce1077daa5e0c6daa95621426488bce06a799881287619204933f2dc9b382ac0c5f63674
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format nested
2
- --color
1
+ --format documentation
2
+ --color
data/README.md CHANGED
@@ -9,7 +9,7 @@ Installation
9
9
  ====
10
10
  Via bundler:
11
11
  ```ruby
12
- gem 'constantcontact', '~> 2.2.0'
12
+ gem 'constantcontact', '~> 3.0.0'
13
13
  ```
14
14
  Otherwise:
15
15
  ```bash
@@ -134,3 +134,58 @@ Create a my_view.erb with the following code:
134
134
  The first time you access the action in browser you should see the "Click to authorize" link.
135
135
  Follow the link, go through all the Constant Contact steps required
136
136
  and then you will be redirected back to your action and you should see the list of contacts.
137
+
138
+ Example
139
+ =====
140
+ Add a new contact using the Ruby SDK
141
+ ```
142
+ #gem install constantcontact
143
+
144
+ require 'yaml'
145
+ require 'constantcontact'
146
+
147
+ class ContactExample
148
+
149
+ def initialize()
150
+ cnf = YAML::load(File.open('config/config.yml'))
151
+ @cc = ConstantContact::Api.new(cnf['api_key'], cnf['oauth_token'])
152
+ end
153
+
154
+ def add_contact( contact_json )
155
+ @cc.add_contact( contact_json )
156
+ end
157
+
158
+ def get_lists
159
+ @cc.get_lists()
160
+ end
161
+
162
+ end
163
+ class AddContactTest
164
+ def do()
165
+ contact_example = ContactExample.new
166
+ contact_list = contact_example.get_lists[0].id
167
+ puts "Add what email address?"
168
+ email_address = gets.chomp
169
+ puts "Adding #{email_address} to Contact List #{contact_list}"
170
+
171
+ list_to_add_to = ConstantContact::Components::ContactList.new
172
+ list_to_add_to.id = contact_list
173
+
174
+ new_contact = ConstantContact::Components::Contact.new
175
+ new_contact.add_email(ConstantContact::Components::EmailAddress.new(email_address))
176
+ new_contact.add_list(list_to_add_to)
177
+ new_contact.first_name = 'Example'
178
+ new_contact.last_name = 'User'
179
+
180
+ #input = "{ 'email_addresses':[{'email_address':'#{email_address}'}], 'lists':[{'id':'#{contact_list}'}], first_name':'Example', 'last_name':'User'}"
181
+ #puts input
182
+ puts new_contact.to_json
183
+
184
+ puts contact_example.add_contact( new_contact ).to_json
185
+
186
+ rescue RestClient::BadRequest => e
187
+ puts "#{e.http_code} - #{e.http_body}"
188
+ end
189
+ end
190
+ AddContactTest.new.do
191
+ ```
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "constantcontact"
8
- s.version = '2.2.1'
8
+ s.version = '3.0.0'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["ConstantContact"]
11
11
  s.homepage = "http://www.constantcontact.com"
@@ -6,26 +6,40 @@
6
6
 
7
7
  module ConstantContact
8
8
  class Api
9
+
10
+ attr_accessor :api_key, :access_token
11
+
9
12
  # Class constructor
10
13
  # @param [String] api_key - Constant Contact API Key
11
14
  # @param [String] access_token - Constant Contact OAuth2 access token
12
15
  # @return
13
16
  def initialize(api_key = nil, access_token = nil)
14
- Services::BaseService.api_key = api_key || Util::Config.get('auth.api_key')
15
- Services::BaseService.access_token = access_token
16
- if Services::BaseService.api_key.nil? || Services::BaseService.api_key == ''
17
+ @api_key = api_key || Util::Config.get('auth.api_key')
18
+ @access_token = access_token
19
+ if @api_key.nil? || @api_key == ''
17
20
  raise ArgumentError.new(Util::Config.get('errors.api_key_missing'))
18
21
  end
19
- if Services::BaseService.access_token.nil? || Services::BaseService.access_token == ''
22
+ if @access_token.nil? || @access_token == ''
20
23
  raise ArgumentError.new(Util::Config.get('errors.access_token_missing'))
21
24
  end
25
+
26
+ @account_service = Services::AccountService.new(self)
27
+ @activity_service = Services::ActivityService.new(self)
28
+ @campaign_tracking_service = Services::CampaignTrackingService.new(self)
29
+ @campaign_schedule_service = Services::CampaignScheduleService.new(self)
30
+ @contact_service = Services::ContactService.new(self)
31
+ @contact_tracking_service = Services::ContactTrackingService.new(self)
32
+ @email_marketing_service = Services::EmailMarketingService.new(self)
33
+ @event_spot_service = Services::EventSpotService.new(self)
34
+ @library_service = Services::LibraryService.new(self)
35
+ @list_service = Services::ListService.new(self)
22
36
  end
23
37
 
24
38
 
25
39
  # Get a summary of account information
26
40
  # @return [AccountInfo]
27
41
  def get_account_info()
28
- Services::AccountService.get_account_info()
42
+ @account_service.get_account_info()
29
43
  end
30
44
 
31
45
 
@@ -35,7 +49,7 @@ module ConstantContact
35
49
  def get_verified_email_addresses(status = nil)
36
50
  params = {}
37
51
  params['status'] = status if status
38
- Services::AccountService.get_verified_email_addresses(params)
52
+ @account_service.get_verified_email_addresses(params)
39
53
  end
40
54
 
41
55
 
@@ -49,7 +63,7 @@ module ConstantContact
49
63
  # status - a contact status to filter results by. Must be one of ACTIVE, OPTOUT, REMOVED, UNCONFIRMED.
50
64
  # @return [ResultSet<Contact>] a ResultSet of Contacts
51
65
  def get_contacts(params = {})
52
- Services::ContactService.get_contacts(params)
66
+ @contact_service.get_contacts(params)
53
67
  end
54
68
 
55
69
 
@@ -57,7 +71,7 @@ module ConstantContact
57
71
  # @param [Integer] contact_id - Id of the contact to retrieve
58
72
  # @return [Contact]
59
73
  def get_contact(contact_id)
60
- Services::ContactService.get_contact(contact_id)
74
+ @contact_service.get_contact(contact_id)
61
75
  end
62
76
 
63
77
 
@@ -65,7 +79,7 @@ module ConstantContact
65
79
  # @param [String] email - contact email address to search for
66
80
  # @return [ResultSet<Contact>] a ResultSet of Contacts
67
81
  def get_contact_by_email(email)
68
- Services::ContactService.get_contacts({'email' => email})
82
+ @contact_service.get_contacts({'email' => email})
69
83
  end
70
84
 
71
85
 
@@ -76,7 +90,7 @@ module ConstantContact
76
90
  def add_contact(contact, action_by_visitor = false)
77
91
  params = {}
78
92
  params['action_by'] = 'ACTION_BY_VISITOR' if action_by_visitor
79
- Services::ContactService.add_contact(contact, params)
93
+ @contact_service.add_contact(contact, params)
80
94
  end
81
95
 
82
96
 
@@ -86,7 +100,7 @@ module ConstantContact
86
100
  # @return [Boolean]
87
101
  def delete_contact(contact)
88
102
  contact_id = to_id(contact, 'Contact')
89
- Services::ContactService.delete_contact(contact_id)
103
+ @contact_service.delete_contact(contact_id)
90
104
  end
91
105
 
92
106
 
@@ -96,7 +110,7 @@ module ConstantContact
96
110
  # @return [Boolean]
97
111
  def delete_contact_from_lists(contact)
98
112
  contact_id = to_id(contact, 'Contact')
99
- Services::ContactService.delete_contact_from_lists(contact_id)
113
+ @contact_service.delete_contact_from_lists(contact_id)
100
114
  end
101
115
 
102
116
 
@@ -108,7 +122,7 @@ module ConstantContact
108
122
  def delete_contact_from_list(contact, list)
109
123
  contact_id = to_id(contact, 'Contact')
110
124
  list_id = to_id(list, 'ContactList')
111
- Services::ContactService.delete_contact_from_list(contact_id, list_id)
125
+ @contact_service.delete_contact_from_list(contact_id, list_id)
112
126
  end
113
127
 
114
128
 
@@ -119,7 +133,7 @@ module ConstantContact
119
133
  def update_contact(contact, action_by_visitor = false)
120
134
  params = {}
121
135
  params['action_by'] = 'ACTION_BY_VISITOR' if action_by_visitor
122
- Services::ContactService.update_contact(contact, params)
136
+ @contact_service.update_contact(contact, params)
123
137
  end
124
138
 
125
139
 
@@ -129,7 +143,7 @@ module ConstantContact
129
143
  # - modified_since - ISO-8601 formatted timestamp.
130
144
  # @return [Array<ContactList>] Array of ContactList objects
131
145
  def get_lists(params = {})
132
- Services::ListService.get_lists(params)
146
+ @list_service.get_lists(params)
133
147
  end
134
148
 
135
149
 
@@ -137,7 +151,7 @@ module ConstantContact
137
151
  # @param [Integer] list_id - Id of the list to retrieve
138
152
  # @return [ContactList]
139
153
  def get_list(list_id)
140
- Services::ListService.get_list(list_id)
154
+ @list_service.get_list(list_id)
141
155
  end
142
156
 
143
157
 
@@ -145,7 +159,7 @@ module ConstantContact
145
159
  # @param [ContactList] list - List to add
146
160
  # @return [ContactList]
147
161
  def add_list(list)
148
- Services::ListService.add_list(list)
162
+ @list_service.add_list(list)
149
163
  end
150
164
 
151
165
 
@@ -153,7 +167,7 @@ module ConstantContact
153
167
  # @param [ContactList] list - ContactList to update
154
168
  # @return [ContactList]
155
169
  def update_list(list)
156
- Services::ListService.update_list(list)
170
+ @list_service.update_list(list)
157
171
  end
158
172
 
159
173
 
@@ -166,7 +180,7 @@ module ConstantContact
166
180
  def get_contacts_from_list(list, param = nil)
167
181
  list_id = to_id(list, 'ContactList')
168
182
  param = determine_param(param)
169
- Services::ListService.get_contacts_from_list(list_id, param)
183
+ @list_service.get_contacts_from_list(list_id, param)
170
184
  end
171
185
 
172
186
 
@@ -179,7 +193,7 @@ module ConstantContact
179
193
  # email - the contact by email address to retrieve information for
180
194
  # @return [ResultSet<Campaign>]
181
195
  def get_email_campaigns(params = {})
182
- Services::EmailMarketingService.get_campaigns(params)
196
+ @email_marketing_service.get_campaigns(params)
183
197
  end
184
198
 
185
199
 
@@ -187,7 +201,7 @@ module ConstantContact
187
201
  # @param [Integer] campaign_id - Valid campaign id
188
202
  # @return [Campaign]
189
203
  def get_email_campaign(campaign_id)
190
- Services::EmailMarketingService.get_campaign(campaign_id)
204
+ @email_marketing_service.get_campaign(campaign_id)
191
205
  end
192
206
 
193
207
 
@@ -195,7 +209,7 @@ module ConstantContact
195
209
  # @param [Integer] campaign_id - Valid campaign id
196
210
  # @return [CampaignPreview]
197
211
  def get_email_campaign_preview(campaign_id)
198
- Services::EmailMarketingService.get_campaign_preview(campaign_id)
212
+ @email_marketing_service.get_campaign_preview(campaign_id)
199
213
  end
200
214
 
201
215
 
@@ -205,7 +219,7 @@ module ConstantContact
205
219
  # @return [Boolean]
206
220
  def delete_email_campaign(campaign)
207
221
  campaign_id = to_id(campaign, 'Campaign')
208
- Services::EmailMarketingService.delete_campaign(campaign_id)
222
+ @email_marketing_service.delete_campaign(campaign_id)
209
223
  end
210
224
 
211
225
 
@@ -213,7 +227,7 @@ module ConstantContact
213
227
  # @param [Campaign] campaign - Campaign to be created
214
228
  # @return [Campaign] - created campaign
215
229
  def add_email_campaign(campaign)
216
- Services::EmailMarketingService.add_campaign(campaign)
230
+ @email_marketing_service.add_campaign(campaign)
217
231
  end
218
232
 
219
233
 
@@ -221,7 +235,7 @@ module ConstantContact
221
235
  # @param [Campaign] campaign - Campaign to be updated
222
236
  # @return [Campaign] - updated campaign
223
237
  def update_email_campaign(campaign)
224
- Services::EmailMarketingService.update_campaign(campaign)
238
+ @email_marketing_service.update_campaign(campaign)
225
239
  end
226
240
 
227
241
 
@@ -231,7 +245,7 @@ module ConstantContact
231
245
  # @return [Campaign] - updated campaign
232
246
  def add_email_campaign_schedule(campaign, schedule)
233
247
  campaign_id = to_id(campaign, 'Campaign')
234
- Services::CampaignScheduleService.add_schedule(campaign_id, schedule)
248
+ @campaign_schedule_service.add_schedule(campaign_id, schedule)
235
249
  end
236
250
 
237
251
 
@@ -240,7 +254,7 @@ module ConstantContact
240
254
  # @return [Array<Schedule>]
241
255
  def get_email_campaign_schedules(campaign)
242
256
  campaign_id = to_id(campaign, 'Campaign')
243
- Services::CampaignScheduleService.get_schedules(campaign_id)
257
+ @campaign_schedule_service.get_schedules(campaign_id)
244
258
  end
245
259
 
246
260
 
@@ -252,7 +266,7 @@ module ConstantContact
252
266
  def get_email_campaign_schedule(campaign, schedule)
253
267
  campaign_id = to_id(campaign, 'Campaign')
254
268
  schedule_id = to_id(schedule, 'Schedule')
255
- Services::CampaignScheduleService.get_schedule(campaign_id, schedule_id)
269
+ @campaign_schedule_service.get_schedule(campaign_id, schedule_id)
256
270
  end
257
271
 
258
272
 
@@ -262,7 +276,7 @@ module ConstantContact
262
276
  # @return [Schedule]
263
277
  def update_email_campaign_schedule(campaign, schedule)
264
278
  campaign_id = to_id(campaign, 'Campaign')
265
- Services::CampaignScheduleService.update_schedule(campaign_id, schedule)
279
+ @campaign_schedule_service.update_schedule(campaign_id, schedule)
266
280
  end
267
281
 
268
282
 
@@ -274,7 +288,7 @@ module ConstantContact
274
288
  def delete_email_campaign_schedule(campaign, schedule)
275
289
  campaign_id = to_id(campaign, 'Campaign')
276
290
  schedule_id = to_id(schedule, 'Schedule')
277
- Services::CampaignScheduleService.delete_schedule(campaign_id, schedule_id)
291
+ @campaign_schedule_service.delete_schedule(campaign_id, schedule_id)
278
292
  end
279
293
 
280
294
 
@@ -284,7 +298,7 @@ module ConstantContact
284
298
  # @return [TestSend]
285
299
  def send_email_campaign_test(campaign, test_send)
286
300
  campaign_id = to_id(campaign, 'Campaign')
287
- Services::CampaignScheduleService.send_test(campaign_id, test_send)
301
+ @campaign_schedule_service.send_test(campaign_id, test_send)
288
302
  end
289
303
 
290
304
 
@@ -298,7 +312,7 @@ module ConstantContact
298
312
  # @return [ResultSet<SendActivity>]
299
313
  def get_email_campaign_sends(campaign, params = {})
300
314
  campaign_id = to_id(campaign, 'Campaign')
301
- Services::CampaignTrackingService.get_sends(campaign_id, params)
315
+ @campaign_tracking_service.get_sends(campaign_id, params)
302
316
  end
303
317
 
304
318
 
@@ -312,7 +326,7 @@ module ConstantContact
312
326
  # @return [ResultSet<BounceActivity>]
313
327
  def get_email_campaign_bounces(campaign, params = {})
314
328
  campaign_id = to_id(campaign, 'Campaign')
315
- Services::CampaignTrackingService.get_bounces(campaign_id, params)
329
+ @campaign_tracking_service.get_bounces(campaign_id, params)
316
330
  end
317
331
 
318
332
 
@@ -326,7 +340,7 @@ module ConstantContact
326
340
  # @return [ResultSet<ClickActivity>]
327
341
  def get_email_campaign_clicks(campaign, params = {})
328
342
  campaign_id = to_id(campaign, 'Campaign')
329
- Services::CampaignTrackingService.get_clicks(campaign_id, params)
343
+ @campaign_tracking_service.get_clicks(campaign_id, params)
330
344
  end
331
345
 
332
346
 
@@ -340,7 +354,7 @@ module ConstantContact
340
354
  # @return [ResultSet<OpenActivity>]
341
355
  def get_email_campaign_opens(campaign, params = {})
342
356
  campaign_id = to_id(campaign, 'Campaign')
343
- Services::CampaignTrackingService.get_opens(campaign_id, params)
357
+ @campaign_tracking_service.get_opens(campaign_id, params)
344
358
  end
345
359
 
346
360
 
@@ -354,7 +368,7 @@ module ConstantContact
354
368
  # @return [ResultSet<ForwardActivity>]
355
369
  def get_email_campaign_forwards(campaign, params = {})
356
370
  campaign_id = to_id(campaign, 'Campaign')
357
- Services::CampaignTrackingService.get_forwards(campaign_id, params)
371
+ @campaign_tracking_service.get_forwards(campaign_id, params)
358
372
  end
359
373
 
360
374
 
@@ -368,7 +382,7 @@ module ConstantContact
368
382
  # @return [ResultSet<UnsubscribeActivity>] - Containing a results array of UnsubscribeActivity
369
383
  def get_email_campaign_unsubscribes(campaign, params = {})
370
384
  campaign_id = to_id(campaign, 'Campaign')
371
- Services::CampaignTrackingService.get_unsubscribes(campaign_id, params)
385
+ @campaign_tracking_service.get_unsubscribes(campaign_id, params)
372
386
  end
373
387
 
374
388
 
@@ -377,7 +391,7 @@ module ConstantContact
377
391
  # @return [TrackingSummary]
378
392
  def get_email_campaign_summary_report(campaign)
379
393
  campaign_id = to_id(campaign, 'Campaign')
380
- Services::CampaignTrackingService.get_summary(campaign_id)
394
+ @campaign_tracking_service.get_summary(campaign_id)
381
395
  end
382
396
 
383
397
 
@@ -391,7 +405,7 @@ module ConstantContact
391
405
  # @return [ResultSet<SendActivity>]
392
406
  def get_contact_sends(contact, params = {})
393
407
  contact_id = to_id(contact, 'Contact')
394
- Services::ContactTrackingService.get_sends(contact_id, params)
408
+ @contact_tracking_service.get_sends(contact_id, params)
395
409
  end
396
410
 
397
411
 
@@ -405,7 +419,7 @@ module ConstantContact
405
419
  # @return [ResultSet<BounceActivity>]
406
420
  def get_contact_bounces(contact, params = {})
407
421
  contact_id = to_id(contact, 'Contact')
408
- Services::ContactTrackingService.get_bounces(contact_id, params)
422
+ @contact_tracking_service.get_bounces(contact_id, params)
409
423
  end
410
424
 
411
425
 
@@ -419,7 +433,7 @@ module ConstantContact
419
433
  # @return [ResultSet<ClickActivity>]
420
434
  def get_contact_clicks(contact, params = {})
421
435
  contact_id = to_id(contact, 'Contact')
422
- Services::ContactTrackingService.get_clicks(contact_id, params)
436
+ @contact_tracking_service.get_clicks(contact_id, params)
423
437
  end
424
438
 
425
439
 
@@ -433,7 +447,7 @@ module ConstantContact
433
447
  # @return [ResultSet<OpenActivity>]
434
448
  def get_contact_opens(contact, params = {})
435
449
  contact_id = to_id(contact, 'Contact')
436
- Services::ContactTrackingService.get_opens(contact_id, params)
450
+ @contact_tracking_service.get_opens(contact_id, params)
437
451
  end
438
452
 
439
453
 
@@ -447,7 +461,7 @@ module ConstantContact
447
461
  # @return [ResultSet<ForwardActivity>]
448
462
  def get_contact_forwards(contact, params = {})
449
463
  contact_id = to_id(contact, 'Contact')
450
- Services::ContactTrackingService.get_forwards(contact_id, params)
464
+ @contact_tracking_service.get_forwards(contact_id, params)
451
465
  end
452
466
 
453
467
 
@@ -461,7 +475,7 @@ module ConstantContact
461
475
  # @return [UnsubscribeActivity] - Containing a results array of UnsubscribeActivity
462
476
  def get_contact_unsubscribes(contact, params = {})
463
477
  contact_id = to_id(contact, 'Contact')
464
- Services::ContactTrackingService.get_unsubscribes(contact_id, params)
478
+ @contact_tracking_service.get_unsubscribes(contact_id, params)
465
479
  end
466
480
 
467
481
 
@@ -470,7 +484,7 @@ module ConstantContact
470
484
  # @return [TrackingSummary]
471
485
  def get_contact_summary_report(contact)
472
486
  contact_id = to_id(contact, 'Contact')
473
- Services::ContactTrackingService.get_summary(contact_id)
487
+ @contact_tracking_service.get_summary(contact_id)
474
488
  end
475
489
 
476
490
 
@@ -482,7 +496,7 @@ module ConstantContact
482
496
  # EXPORT_CONTACTS
483
497
  # @return [Array<Activity>]
484
498
  def get_activities(params = {})
485
- Services::ActivityService.get_activities(params)
499
+ @activity_service.get_activities(params)
486
500
  end
487
501
 
488
502
 
@@ -490,7 +504,7 @@ module ConstantContact
490
504
  # @param [String] activity_id - Activity id
491
505
  # @return [Activity]
492
506
  def get_activity(activity_id)
493
- Services::ActivityService.get_activity(activity_id)
507
+ @activity_service.get_activity(activity_id)
494
508
  end
495
509
 
496
510
 
@@ -498,7 +512,7 @@ module ConstantContact
498
512
  # @param [AddContacts] add_contacts - Add Contacts Activity
499
513
  # @return [Activity]
500
514
  def add_create_contacts_activity(add_contacts)
501
- Services::ActivityService.create_add_contacts_activity(add_contacts)
515
+ @activity_service.create_add_contacts_activity(add_contacts)
502
516
  end
503
517
 
504
518
 
@@ -508,7 +522,7 @@ module ConstantContact
508
522
  # @param [String] lists - Comma separated list of ContactList id's to add the contacts to
509
523
  # @return [Activity]
510
524
  def add_create_contacts_activity_from_file(file_name, contents, lists)
511
- Services::ActivityService.create_add_contacts_activity_from_file(file_name, contents, lists)
525
+ @activity_service.create_add_contacts_activity_from_file(file_name, contents, lists)
512
526
  end
513
527
 
514
528
 
@@ -516,7 +530,7 @@ module ConstantContact
516
530
  # @param [Array<Lists>] lists - Add Contacts Activity
517
531
  # @return [Activity]
518
532
  def add_clear_lists_activity(lists)
519
- Services::ActivityService.add_clear_lists_activity(lists)
533
+ @activity_service.add_clear_lists_activity(lists)
520
534
  end
521
535
 
522
536
 
@@ -525,7 +539,7 @@ module ConstantContact
525
539
  # @param [Array<Lists>] lists - lists to remove the provided email addresses from
526
540
  # @return [Activity]
527
541
  def add_remove_contacts_from_lists_activity(email_addresses, lists)
528
- Services::ActivityService.add_remove_contacts_from_lists_activity(email_addresses, lists)
542
+ @activity_service.add_remove_contacts_from_lists_activity(email_addresses, lists)
529
543
  end
530
544
 
531
545
 
@@ -535,7 +549,7 @@ module ConstantContact
535
549
  # @param [String] lists - Comma separated list of ContactList id' to add the contacts too
536
550
  # @return [Activity]
537
551
  def add_remove_contacts_from_lists_activity_from_file(file_name, contents, lists)
538
- Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(file_name, contents, lists)
552
+ @activity_service.add_remove_contacts_from_lists_activity_from_file(file_name, contents, lists)
539
553
  end
540
554
 
541
555
 
@@ -543,14 +557,14 @@ module ConstantContact
543
557
  # @param [<Array>Contacts] export_contacts - Contacts to be exported
544
558
  # @return [Activity]
545
559
  def add_export_contacts_activity(export_contacts)
546
- Services::ActivityService.add_export_contacts_activity(export_contacts)
560
+ @activity_service.add_export_contacts_activity(export_contacts)
547
561
  end
548
562
 
549
563
 
550
564
  # Get a list of events
551
565
  # @return [ResultSet<Event>]
552
566
  def get_events()
553
- Services::EventSpotService.get_events()
567
+ @event_spot_service.get_events()
554
568
  end
555
569
 
556
570
 
@@ -558,7 +572,7 @@ module ConstantContact
558
572
  # @param [Event] event - event id or object to be retrieved
559
573
  # @return [Event]
560
574
  def get_event(event)
561
- Services::EventSpotService.get_event(event)
575
+ @event_spot_service.get_event(event)
562
576
  end
563
577
 
564
578
 
@@ -566,7 +580,7 @@ module ConstantContact
566
580
  # @param [Hash] event - Event data stored in an object which respods to to_json
567
581
  # @return [Event]
568
582
  def add_event(event)
569
- Services::EventSpotService.add_event(event)
583
+ @event_spot_service.add_event(event)
570
584
  end
571
585
 
572
586
 
@@ -574,7 +588,7 @@ module ConstantContact
574
588
  # @param [Event|Hash] event - Event details stored in an object that responds to to_json and has an :id attribute
575
589
  # @return [Event]
576
590
  def update_event(event)
577
- Services::EventSpotService.update_event(event)
591
+ @event_spot_service.update_event(event)
578
592
  end
579
593
 
580
594
 
@@ -582,7 +596,7 @@ module ConstantContact
582
596
  # @param [Event] event - Event to publish
583
597
  # @return [Event]
584
598
  def publish_event(event)
585
- Services::EventSpotService.publish_event(event)
599
+ @event_spot_service.publish_event(event)
586
600
  end
587
601
 
588
602
 
@@ -590,7 +604,7 @@ module ConstantContact
590
604
  # @param [Event] event - Event to cancel
591
605
  # @return [Event]
592
606
  def cancel_event(event)
593
- Services::EventSpotService.cancel_event(event)
607
+ @event_spot_service.cancel_event(event)
594
608
  end
595
609
 
596
610
 
@@ -598,7 +612,7 @@ module ConstantContact
598
612
  # @param [Event] event - Event to get fees of
599
613
  # @return [<Array>EventFee]
600
614
  def get_event_fees(event)
601
- Services::EventSpotService.get_fees(event)
615
+ @event_spot_service.get_fees(event)
602
616
  end
603
617
 
604
618
 
@@ -607,7 +621,7 @@ module ConstantContact
607
621
  # @param [EventFee] fee - Fee to retrieve
608
622
  # @return [EventFee]
609
623
  def get_event_fee(event, fee)
610
- Services::EventSpotService.get_fee(event, fee)
624
+ @event_spot_service.get_fee(event, fee)
611
625
  end
612
626
 
613
627
 
@@ -616,7 +630,7 @@ module ConstantContact
616
630
  # @param [Hash] fee - Fee details
617
631
  # @return [EventFee]
618
632
  def add_event_fee(event, fee)
619
- Services::EventSpotService.add_fee(event, fee)
633
+ @event_spot_service.add_fee(event, fee)
620
634
  end
621
635
 
622
636
 
@@ -625,7 +639,7 @@ module ConstantContact
625
639
  # @param [EventFee] fee - Fee details
626
640
  # @return [EventFee]
627
641
  def update_event_fee(event, fee)
628
- Services::EventSpotService.update_fee(event, fee)
642
+ @event_spot_service.update_fee(event, fee)
629
643
  end
630
644
 
631
645
 
@@ -634,7 +648,7 @@ module ConstantContact
634
648
  # @param [EventFee] fee - Fee details
635
649
  # @return [Boolean]
636
650
  def delete_event_fee(event, fee)
637
- Services::EventSpotService.delete_fee(event, fee)
651
+ @event_spot_service.delete_fee(event, fee)
638
652
  end
639
653
 
640
654
 
@@ -642,7 +656,7 @@ module ConstantContact
642
656
  # @param [Event] event - Event fee corresponds to
643
657
  # @return [ResultSet<Registrant>]
644
658
  def get_event_registrants(event)
645
- Services::EventSpotService.get_registrants(event)
659
+ @event_spot_service.get_registrants(event)
646
660
  end
647
661
 
648
662
 
@@ -651,7 +665,7 @@ module ConstantContact
651
665
  # @param [Registrant] registrant - registrant details
652
666
  # @return [Registrant]
653
667
  def get_event_registrant(event, registrant)
654
- Services::EventSpotService.get_registrant(event, registrant)
668
+ @event_spot_service.get_registrant(event, registrant)
655
669
  end
656
670
 
657
671
 
@@ -659,7 +673,7 @@ module ConstantContact
659
673
  # @param [Integer] event_id - event id to retrieve items for
660
674
  # @return [Array<EventItem>]
661
675
  def get_event_items(event_id)
662
- Services::EventSpotService.get_event_items(event_id)
676
+ @event_spot_service.get_event_items(event_id)
663
677
  end
664
678
 
665
679
 
@@ -668,7 +682,7 @@ module ConstantContact
668
682
  # @param [Integer] item_id - id of item to be retrieved
669
683
  # @return [EventItem]
670
684
  def get_event_item(event_id, item_id)
671
- Services::EventSpotService.get_event_item(event_id, item_id)
685
+ @event_spot_service.get_event_item(event_id, item_id)
672
686
  end
673
687
 
674
688
 
@@ -677,7 +691,7 @@ module ConstantContact
677
691
  # @param [EventItem] event_item - event item to be created
678
692
  # @return [EventItem]
679
693
  def add_event_item(event_id, event_item)
680
- Services::EventSpotService.add_event_item(event_id, event_item)
694
+ @event_spot_service.add_event_item(event_id, event_item)
681
695
  end
682
696
 
683
697
 
@@ -686,7 +700,7 @@ module ConstantContact
686
700
  # @param [Integer] item_id - id of event item to be deleted
687
701
  # @return [Boolean]
688
702
  def delete_event_item(event_id, item_id)
689
- Services::EventSpotService.delete_event_item(event_id, item_id)
703
+ @event_spot_service.delete_event_item(event_id, item_id)
690
704
  end
691
705
 
692
706
 
@@ -695,7 +709,7 @@ module ConstantContact
695
709
  # @param [EventItem] event_item - event item to be updated
696
710
  # @return [EventItem]
697
711
  def update_event_item(event_id, event_item)
698
- Services::EventSpotService.update_event_item(event_id, event_item)
712
+ @event_spot_service.update_event_item(event_id, event_item)
699
713
  end
700
714
 
701
715
 
@@ -704,7 +718,7 @@ module ConstantContact
704
718
  # @param [Integer] item_id - event item id to retrieve attributes for
705
719
  # @return [Array<EventItemAttribute>]
706
720
  def get_event_item_attributes(event_id, item_id)
707
- Services::EventSpotService.get_event_item_attributes(event_id, item_id)
721
+ @event_spot_service.get_event_item_attributes(event_id, item_id)
708
722
  end
709
723
 
710
724
 
@@ -714,7 +728,7 @@ module ConstantContact
714
728
  # @param [Integer] attribute_id - id of attribute to be retrieved
715
729
  # @return [EventItemAttribute]
716
730
  def get_event_item_attribute(event_id, item_id, attribute_id)
717
- Services::EventSpotService.get_event_item_attribute(event_id, item_id, attribute_id)
731
+ @event_spot_service.get_event_item_attribute(event_id, item_id, attribute_id)
718
732
  end
719
733
 
720
734
 
@@ -724,7 +738,7 @@ module ConstantContact
724
738
  # @param [EventItemAttribute] event_item_attribute - event item attribute to be created
725
739
  # @return [EventItemAttribute]
726
740
  def add_event_item_attribute(event_id, item_id, event_item_attribute)
727
- Services::EventSpotService.add_event_item_attribute(event_id, item_id, event_item_attribute)
741
+ @event_spot_service.add_event_item_attribute(event_id, item_id, event_item_attribute)
728
742
  end
729
743
 
730
744
 
@@ -734,7 +748,7 @@ module ConstantContact
734
748
  # @param [Integer] attribute_id - id of attribute to be deleted
735
749
  # @return [Boolean]
736
750
  def delete_event_item_attribute(event_id, item_id, attribute_id)
737
- Services::EventSpotService.delete_event_item_attribute(event_id, item_id, attribute_id)
751
+ @event_spot_service.delete_event_item_attribute(event_id, item_id, attribute_id)
738
752
  end
739
753
 
740
754
 
@@ -744,7 +758,7 @@ module ConstantContact
744
758
  # @param [EventItemAttribute] event_item_attribute - event item to be updated
745
759
  # @return [EventItemAttribute]
746
760
  def update_event_item_attribute(event_id, item_id, event_item_attribute)
747
- Services::EventSpotService.update_event_item_attribute(event_id, item_id, event_item_attribute)
761
+ @event_spot_service.update_event_item_attribute(event_id, item_id, event_item_attribute)
748
762
  end
749
763
 
750
764
 
@@ -752,7 +766,7 @@ module ConstantContact
752
766
  # @param [Integer] event_id - event id to retrieve promocodes for
753
767
  # @return [Array<Promocode>]
754
768
  def get_promocodes(event_id)
755
- Services::EventSpotService.get_promocodes(event_id)
769
+ @event_spot_service.get_promocodes(event_id)
756
770
  end
757
771
 
758
772
 
@@ -761,7 +775,7 @@ module ConstantContact
761
775
  # @param [Integer] promocode_id - id of item to be retrieved
762
776
  # @return [Promocode]
763
777
  def get_promocode(event_id, promocode_id)
764
- Services::EventSpotService.get_promocode(event_id, promocode_id)
778
+ @event_spot_service.get_promocode(event_id, promocode_id)
765
779
  end
766
780
 
767
781
 
@@ -770,7 +784,7 @@ module ConstantContact
770
784
  # @param [Promocode] promocode - promocode to be created
771
785
  # @return [Promocode]
772
786
  def add_promocode(event_id, promocode)
773
- Services::EventSpotService.add_promocode(event_id, promocode)
787
+ @event_spot_service.add_promocode(event_id, promocode)
774
788
  end
775
789
 
776
790
 
@@ -779,7 +793,7 @@ module ConstantContact
779
793
  # @param [Integer] promocode_id - id of promocode to be deleted
780
794
  # @return [Boolean]
781
795
  def delete_promocode(event_id, promocode_id)
782
- Services::EventSpotService.delete_promocode(event_id, promocode_id)
796
+ @event_spot_service.delete_promocode(event_id, promocode_id)
783
797
  end
784
798
 
785
799
 
@@ -788,14 +802,14 @@ module ConstantContact
788
802
  # @param [Promocode] promocode - promocode to be updated
789
803
  # @return [Promocode]
790
804
  def update_promocode(event_id, promocode)
791
- Services::EventSpotService.update_promocode(event_id, promocode)
805
+ @event_spot_service.update_promocode(event_id, promocode)
792
806
  end
793
807
 
794
808
 
795
809
  # Retrieve MyLibrary usage information
796
810
  # @return [LibrarySummary]
797
811
  def get_library_info()
798
- Services::LibraryService.get_library_info()
812
+ @library_service.get_library_info()
799
813
  end
800
814
 
801
815
 
@@ -812,7 +826,7 @@ module ConstantContact
812
826
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
813
827
  # @return [ResultSet<LibraryFolder>]
814
828
  def get_library_folders(params = {})
815
- Services::LibraryService.get_library_folders(params)
829
+ @library_service.get_library_folders(params)
816
830
  end
817
831
 
818
832
 
@@ -820,7 +834,7 @@ module ConstantContact
820
834
  # @param [LibraryFolder] folder - Library Folder to be created
821
835
  # @return [LibraryFolder]
822
836
  def add_library_folder(folder)
823
- Services::LibraryService.add_library_folder(folder)
837
+ @library_service.add_library_folder(folder)
824
838
  end
825
839
 
826
840
 
@@ -828,7 +842,7 @@ module ConstantContact
828
842
  # @param [String] folder_id - The ID for the folder to return
829
843
  # @return [LibraryFolder]
830
844
  def get_library_folder(folder_id)
831
- Services::LibraryService.get_library_folder(folder_id)
845
+ @library_service.get_library_folder(folder_id)
832
846
  end
833
847
 
834
848
 
@@ -836,7 +850,7 @@ module ConstantContact
836
850
  # @param [LibraryFolder] folder - MyLibrary folder to be updated
837
851
  # @return [LibraryFolder]
838
852
  def update_library_folder(folder)
839
- Services::LibraryService.update_library_folder(folder)
853
+ @library_service.update_library_folder(folder)
840
854
  end
841
855
 
842
856
 
@@ -844,7 +858,7 @@ module ConstantContact
844
858
  # @param [String] folder_id - The ID for the MyLibrary folder to delete
845
859
  # @return [Boolean]
846
860
  def delete_library_folder(folder_id)
847
- Services::LibraryService.delete_library_folder(folder_id)
861
+ @library_service.delete_library_folder(folder_id)
848
862
  end
849
863
 
850
864
 
@@ -866,14 +880,14 @@ module ConstantContact
866
880
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
867
881
  # @return [ResultSet<LibraryFile>]
868
882
  def get_library_trash(params = {})
869
- Services::LibraryService.get_library_trash(params)
883
+ @library_service.get_library_trash(params)
870
884
  end
871
885
 
872
886
 
873
887
  # Permanently deletes all files in the Trash folder
874
888
  # @return [Boolean]
875
889
  def delete_library_trash()
876
- Services::LibraryService.delete_library_trash()
890
+ @library_service.delete_library_trash()
877
891
  end
878
892
 
879
893
 
@@ -892,7 +906,7 @@ module ConstantContact
892
906
  # limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50.
893
907
  # @return [ResultSet<LibraryFile>]
894
908
  def get_library_files(params = {})
895
- Services::LibraryService.get_library_files(params)
909
+ @library_service.get_library_files(params)
896
910
  end
897
911
 
898
912
 
@@ -903,7 +917,7 @@ module ConstantContact
903
917
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
904
918
  # @return [ResultSet<LibraryFile>]
905
919
  def get_library_files_by_folder(folder_id, params = {})
906
- Services::LibraryService.get_library_files_by_folder(folder_id, params)
920
+ @library_service.get_library_files_by_folder(folder_id, params)
907
921
  end
908
922
 
909
923
 
@@ -911,7 +925,7 @@ module ConstantContact
911
925
  # @param [String] file_id - Specifies the MyLibrary file for which to retrieve information
912
926
  # @return [LibraryFile]
913
927
  def get_library_file(file_id)
914
- Services::LibraryService.get_library_file(file_id)
928
+ @library_service.get_library_file(file_id)
915
929
  end
916
930
 
917
931
 
@@ -927,7 +941,7 @@ module ConstantContact
927
941
  # @param [String] contents - The content of the file
928
942
  # @return [LibraryFile]
929
943
  def add_library_file(file_name, folder_id, description, source, file_type, contents)
930
- Services::LibraryService.add_library_file(file_name, folder_id, description, source, file_type, contents)
944
+ @library_service.add_library_file(file_name, folder_id, description, source, file_type, contents)
931
945
  end
932
946
 
933
947
 
@@ -935,7 +949,7 @@ module ConstantContact
935
949
  # @param [LibraryFile] file - Library File to be updated
936
950
  # @return [LibraryFile]
937
951
  def update_library_file(file)
938
- Services::LibraryService.update_library_file(file)
952
+ @library_service.update_library_file(file)
939
953
  end
940
954
 
941
955
 
@@ -945,7 +959,7 @@ module ConstantContact
945
959
  # @param [String] file_id - Specifies the MyLibrary file to delete
946
960
  # @return [Boolean]
947
961
  def delete_library_file(file_id)
948
- Services::LibraryService.delete_library_file(file_id)
962
+ @library_service.delete_library_file(file_id)
949
963
  end
950
964
 
951
965
 
@@ -954,7 +968,7 @@ module ConstantContact
954
968
  # @param [String] file_id - Specifies the files for which to retrieve upload status information
955
969
  # @return [Array<UploadStatus>]
956
970
  def get_library_files_upload_status(file_id)
957
- Services::LibraryService.get_library_files_upload_status(file_id)
971
+ @library_service.get_library_files_upload_status(file_id)
958
972
  end
959
973
 
960
974
 
@@ -964,7 +978,7 @@ module ConstantContact
964
978
  # @param [String] file_id - Specifies the files to move, in a string of comma separated file ids (e.g. 8,9)
965
979
  # @return [Array<MoveResults>]
966
980
  def move_library_files(folder_id, file_id)
967
- Services::LibraryService.move_library_files(folder_id, file_id)
981
+ @library_service.move_library_files(folder_id, file_id)
968
982
  end
969
983
 
970
984