constantcontact 1.3.2 → 2.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/README.md +5 -5
  3. data/constantcontact.gemspec +2 -2
  4. data/lib/constantcontact/api.rb +223 -307
  5. data/lib/constantcontact/services/account_service.rb +5 -7
  6. data/lib/constantcontact/services/activity_service.rb +16 -24
  7. data/lib/constantcontact/services/base_service.rb +3 -4
  8. data/lib/constantcontact/services/campaign_schedule_service.rb +12 -18
  9. data/lib/constantcontact/services/campaign_tracking_service.rb +14 -21
  10. data/lib/constantcontact/services/contact_service.rb +14 -21
  11. data/lib/constantcontact/services/contact_tracking_service.rb +14 -21
  12. data/lib/constantcontact/services/email_marketing_service.rb +10 -15
  13. data/lib/constantcontact/services/event_spot_service.rb +56 -85
  14. data/lib/constantcontact/services/library_service.rb +32 -48
  15. data/lib/constantcontact/services/list_service.rb +10 -15
  16. data/lib/constantcontact/util/config.rb +5 -3
  17. data/lib/constantcontact/version.rb +3 -3
  18. data/spec/constantcontact/api_spec.rb +121 -103
  19. data/spec/constantcontact/services/account_service_spec.rb +15 -1
  20. data/spec/constantcontact/services/activity_service_spec.rb +9 -14
  21. data/spec/constantcontact/services/base_service_spec.rb +2 -1
  22. data/spec/constantcontact/services/campaign_schedule_service_spec.rb +6 -6
  23. data/spec/constantcontact/services/campaign_tracking_service_spec.rb +7 -7
  24. data/spec/constantcontact/services/contact_service_spec.rb +7 -7
  25. data/spec/constantcontact/services/contact_tracking_service_spec.rb +7 -7
  26. data/spec/constantcontact/services/email_marketing_spec.rb +5 -5
  27. data/spec/constantcontact/services/event_spot_spec.rb +27 -27
  28. data/spec/constantcontact/services/library_service_spec.rb +16 -16
  29. data/spec/constantcontact/services/list_service_spec.rb +5 -5
  30. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ec7eddab3cbc734afcf72f8bcf34529a7dee134
4
- data.tar.gz: 2bea0ebb2a606bd96845351699ca6b06495b1d1e
3
+ metadata.gz: a62eb89dbb6c140c7b0d4a7e2b610ad40978c978
4
+ data.tar.gz: 87dc2f27eea4951d0ea022c189455d133d191c4a
5
5
  SHA512:
6
- metadata.gz: ffbf85e9c9809dd910f214a98816ec8e8e3f94f79a5a21e0f6e82b086ca9d7b2d0802ca1d462dfed3cfe78ebc7d7ea1eda6c7b1b03acce1641eea9345da6ce1f
7
- data.tar.gz: 01a11bbb4d02fca3d7d86fe7991d35de87f5f468b9fc28ff983053734670b0562b4048618bc903e57040a429cb8e2ef8b1cd5c54555c3f0e74e71310634a3c47
6
+ metadata.gz: d9845fbdd02f3531a802142399abb43f8dc563136791eed1d478c29a7b7872685b6e447077901825bdd292a507e8de5cbe29d258430506b3d7dc10c00669528e
7
+ data.tar.gz: 4f4d0270d8f4923e30f55da876335691461748522e95f740b2c5ab7715f5fac0d48371962007e8e94a3974659b7e8a1994ce8cdf454cbfc9cf632f90eefed6b4
data/README.md CHANGED
@@ -9,7 +9,7 @@ Installation
9
9
  ====
10
10
  Via bundler:
11
11
  ```ruby
12
- gem 'constantcontact', '~> 1.3.2'
12
+ gem 'constantcontact', '~> 2.0.0'
13
13
  ```
14
14
  Otherwise:
15
15
  ```bash
@@ -49,8 +49,8 @@ if @code.present?
49
49
  response = @oauth.get_access_token(@code)
50
50
  if response.present?
51
51
  token = response['access_token']
52
- cc = ConstantContact::Api.new('your api key')
53
- @contacts = cc.get_contacts(token)
52
+ cc = ConstantContact::Api.new('your api key', token)
53
+ @contacts = cc.get_contacts()
54
54
  end
55
55
  else
56
56
  # if not code param is provided redirect into the OAuth flow
@@ -99,8 +99,8 @@ get '/my_url' do
99
99
  response = @oauth.get_access_token(@code)
100
100
  if response
101
101
  token = response['access_token']
102
- cc = ConstantContact::Api.new('your api key')
103
- @contacts = cc.get_contacts(token)
102
+ cc = ConstantContact::Api.new('your api key', token)
103
+ @contacts = cc.get_contacts()
104
104
  end
105
105
  end
106
106
 
@@ -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 = '1.3.2'
8
+ s.version = '2.0.0'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["ConstantContact"]
11
11
  s.homepage = "http://www.constantcontact.com"
@@ -28,4 +28,4 @@ Gem::Specification.new do |s|
28
28
  s.add_runtime_dependency("json", '~> 1.8', '>= 1.8.1')
29
29
  s.add_runtime_dependency('mime-types', '~> 1.25', '>= 1.25.1')
30
30
  s.add_development_dependency("rspec", '~> 2.14')
31
- end
31
+ end
@@ -8,33 +8,38 @@ module ConstantContact
8
8
  class Api
9
9
  # Class constructor
10
10
  # @param [String] api_key - Constant Contact API Key
11
+ # @param [String] access_token - Constant Contact OAuth2 access token
11
12
  # @return
12
- def initialize(api_key = nil)
13
+ def initialize(api_key = nil, access_token = nil)
13
14
  Services::BaseService.api_key = api_key || Util::Config.get('auth.api_key')
15
+ Services::BaseService.access_token = access_token
14
16
  if Services::BaseService.api_key.nil? || Services::BaseService.api_key == ''
15
- raise ArgumentError.new("api_key required either explicitly or in configuration.")
17
+ raise ArgumentError.new(Util::Config.get('errors.api_key_missing'))
18
+ end
19
+ if Services::BaseService.access_token.nil? || Services::BaseService.access_token == ''
20
+ raise ArgumentError.new(Util::Config.get('errors.access_token_missing'))
16
21
  end
17
22
  end
18
23
 
19
24
 
20
- def get_account_info(access_token)
21
- Services::AccountService.get_account_info(access_token)
25
+ # Get a summary of account information
26
+ # @return [AccountInfo]
27
+ def get_account_info()
28
+ Services::AccountService.get_account_info()
22
29
  end
23
30
 
24
31
 
25
32
  # Get verified addresses for the account
26
- # @param [String] access_token - Valid access token
27
33
  # @param [String] status - status to filter query results by
28
34
  # @return [Array<VerifiedEmailAddress>] an array of email addresses
29
- def get_verified_email_addresses(access_token, status = nil)
35
+ def get_verified_email_addresses(status = nil)
30
36
  params = {}
31
37
  params['status'] = status if status
32
- Services::AccountService.get_verified_email_addresses(access_token, params)
38
+ Services::AccountService.get_verified_email_addresses(params)
33
39
  end
34
40
 
35
41
 
36
42
  # Get a set of contacts
37
- # @param [String] access_token - Valid access token
38
43
  # @param [Hash] params - hash of query parameters and values to append to the request.
39
44
  # Allowed parameters include:
40
45
  # limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50.
@@ -43,142 +48,129 @@ module ConstantContact
43
48
  # email - the contact by email address to retrieve information for.
44
49
  # status - a contact status to filter results by. Must be one of ACTIVE, OPTOUT, REMOVED, UNCONFIRMED.
45
50
  # @return [ResultSet<Contact>] a ResultSet of Contacts
46
- def get_contacts(access_token, params = {})
47
- Services::ContactService.get_contacts(access_token, params)
51
+ def get_contacts(params = {})
52
+ Services::ContactService.get_contacts(params)
48
53
  end
49
54
 
50
55
 
51
56
  # Get an individual contact
52
- # @param [String] access_token - Valid access token
53
57
  # @param [Integer] contact_id - Id of the contact to retrieve
54
58
  # @return [Contact]
55
- def get_contact(access_token, contact_id)
56
- Services::ContactService.get_contact(access_token, contact_id)
59
+ def get_contact(contact_id)
60
+ Services::ContactService.get_contact(contact_id)
57
61
  end
58
62
 
59
63
 
60
64
  # Get contacts with a specified email eaddress
61
- # @param [String] access_token - Constant Contact OAuth2 access token
62
65
  # @param [String] email - contact email address to search for
63
66
  # @return [ResultSet<Contact>] a ResultSet of Contacts
64
- def get_contact_by_email(access_token, email)
65
- Services::ContactService.get_contacts(access_token, {'email' => email})
67
+ def get_contact_by_email(email)
68
+ Services::ContactService.get_contacts({'email' => email})
66
69
  end
67
70
 
68
71
 
69
72
  # Add a new contact to an account
70
- # @param [String] access_token - Valid access token
71
73
  # @param [Contact] contact - Contact to add
72
74
  # @param [Boolean] action_by_visitor - if the action is being taken by the visitor
73
75
  # @return [Contact]
74
- def add_contact(access_token, contact, action_by_visitor = false)
76
+ def add_contact(contact, action_by_visitor = false)
75
77
  params = {}
76
78
  params['action_by'] = 'ACTION_BY_VISITOR' if action_by_visitor
77
- Services::ContactService.add_contact(access_token, contact, params)
79
+ Services::ContactService.add_contact(contact, params)
78
80
  end
79
81
 
80
82
 
81
83
  # Sets an individual contact to 'REMOVED' status
82
- # @param [String] access_token - Valid access token
83
84
  # @param [Mixed] contact - Either a Contact id or the Contact itself
84
85
  # @raise [IllegalArgumentException] If contact is not an integer or a Contact object
85
86
  # @return [Boolean]
86
- def delete_contact(access_token, contact)
87
- contact_id = get_argument_id(contact, 'Contact')
88
- Services::ContactService.delete_contact(access_token, contact_id)
87
+ def delete_contact(contact)
88
+ contact_id = to_id(contact, 'Contact')
89
+ Services::ContactService.delete_contact(contact_id)
89
90
  end
90
91
 
91
92
 
92
93
  # Delete a contact from all contact lists
93
- # @param [String] access_token - Constant Contact OAuth2 access token
94
94
  # @param [Mixed] contact - Contact id or the Contact object itself
95
95
  # @raise [IllegalArgumentException] If contact is not an integer or a Contact object
96
96
  # @return [Boolean]
97
- def delete_contact_from_lists(access_token, contact)
98
- contact_id = get_argument_id(contact, 'Contact')
99
- Services::ContactService.delete_contact_from_lists(access_token, contact_id)
97
+ def delete_contact_from_lists(contact)
98
+ contact_id = to_id(contact, 'Contact')
99
+ Services::ContactService.delete_contact_from_lists(contact_id)
100
100
  end
101
101
 
102
102
 
103
103
  # Delete a contact from all contact lists
104
- # @param [String] access_token - Constant Contact OAuth2 access token
105
104
  # @param [Mixed] contact - Contact id or a Contact object
106
105
  # @param [Mixed] list - ContactList id or a ContactList object
107
106
  # @raise [IllegalArgumentException] If contact is not an integer or a Contact object
108
107
  # @return [Boolean]
109
- def delete_contact_from_list(access_token, contact, list)
110
- contact_id = get_argument_id(contact, 'Contact')
111
- list_id = get_argument_id(list, 'ContactList')
112
- Services::ContactService.delete_contact_from_list(access_token, contact_id, list_id)
108
+ def delete_contact_from_list(contact, list)
109
+ contact_id = to_id(contact, 'Contact')
110
+ list_id = to_id(list, 'ContactList')
111
+ Services::ContactService.delete_contact_from_list(contact_id, list_id)
113
112
  end
114
113
 
115
114
 
116
115
  # Update an individual contact
117
- # @param [String] access_token - Valid access token
118
116
  # @param [Contact] contact - Contact to update
119
117
  # @param [Boolean] action_by_visitor - if the action is being taken by the visitor
120
118
  # @return [Contact]
121
- def update_contact(access_token, contact, action_by_visitor = false)
119
+ def update_contact(contact, action_by_visitor = false)
122
120
  params = {}
123
121
  params['action_by'] = 'ACTION_BY_VISITOR' if action_by_visitor
124
- Services::ContactService.update_contact(access_token, contact, params)
122
+ Services::ContactService.update_contact(contact, params)
125
123
  end
126
124
 
127
125
 
128
126
  # Get lists
129
- # @param [String] access_token - Valid access token
130
127
  # @param [Hash] params - hash of query parameters and values to append to the request.
131
128
  # Allowed parameters include:
132
129
  # - modified_since - ISO-8601 formatted timestamp.
133
130
  # @return [Array<ContactList>] Array of ContactList objects
134
- def get_lists(access_token, params = {})
135
- Services::ListService.get_lists(access_token, params)
131
+ def get_lists(params = {})
132
+ Services::ListService.get_lists(params)
136
133
  end
137
134
 
138
135
 
139
136
  # Get an individual list
140
- # @param [String] access_token - Valid access token
141
137
  # @param [Integer] list_id - Id of the list to retrieve
142
138
  # @return [ContactList]
143
- def get_list(access_token, list_id)
144
- Services::ListService.get_list(access_token, list_id)
139
+ def get_list(list_id)
140
+ Services::ListService.get_list(list_id)
145
141
  end
146
142
 
147
143
 
148
144
  # Add a new list to an account
149
- # @param [String] access_token - Valid access token
150
145
  # @param [ContactList] list - List to add
151
146
  # @return [ContactList]
152
- def add_list(access_token, list)
153
- Services::ListService.add_list(access_token, list)
147
+ def add_list(list)
148
+ Services::ListService.add_list(list)
154
149
  end
155
150
 
156
151
 
157
152
  # Update a contact list
158
- # @param [String] access_token - Valid access token
159
153
  # @param [ContactList] list - ContactList to update
160
154
  # @return [ContactList]
161
- def update_list(access_token, list)
162
- Services::ListService.update_list(access_token, list)
155
+ def update_list(list)
156
+ Services::ListService.update_list(list)
163
157
  end
164
158
 
165
159
 
166
160
  # Get contact that belong to a specific list
167
- # @param [String] access_token - Constant Contact OAuth2 access token
168
161
  # @param [Mixed] list - Integer id of the list or ContactList object
169
162
  # @param [Mixed] param - denotes the number of results per set, limited to 50, or a next parameter provided
170
163
  # from a previous getContactsFromList call
171
164
  # @raise [IllegalArgumentException] If contact is not an integer or contact
172
165
  # @return [Array<Contact>] An array of contacts
173
- def get_contacts_from_list(access_token, list, param = nil)
174
- list_id = get_argument_id(list, 'ContactList')
166
+ def get_contacts_from_list(list, param = nil)
167
+ list_id = to_id(list, 'ContactList')
175
168
  param = determine_param(param)
176
- Services::ListService.get_contacts_from_list(access_token, list_id, param)
169
+ Services::ListService.get_contacts_from_list(list_id, param)
177
170
  end
178
171
 
179
172
 
180
173
  # Get a set of campaigns
181
- # @param [String] access_token - Constant Contact OAuth2 access token
182
174
  # @param [Mixed] params - hash of query parameters and values to append to the request.
183
175
  # Allowed parameters include:
184
176
  # limit - Specifies the number of results displayed per page of output, from 1 - 500, default = 50.
@@ -186,120 +178,109 @@ module ConstantContact
186
178
  # next - the next link returned from a previous paginated call. May only be used by itself.
187
179
  # email - the contact by email address to retrieve information for
188
180
  # @return [ResultSet<Campaign>]
189
- def get_email_campaigns(access_token, params = {})
190
- Services::EmailMarketingService.get_campaigns(access_token, params)
181
+ def get_email_campaigns(params = {})
182
+ Services::EmailMarketingService.get_campaigns(params)
191
183
  end
192
184
 
193
185
 
194
186
  # Get an individual campaign
195
- # @param [String] access_token - Constant Contact OAuth2 access token
196
187
  # @param [Integer] campaign_id - Valid campaign id
197
188
  # @return [Campaign]
198
- def get_email_campaign(access_token, campaign_id)
199
- Services::EmailMarketingService.get_campaign(access_token, campaign_id)
189
+ def get_email_campaign(campaign_id)
190
+ Services::EmailMarketingService.get_campaign(campaign_id)
200
191
  end
201
192
 
202
193
 
203
194
  # Delete an individual campaign
204
- # @param [String] access_token - Constant Contact OAuth2 access token
205
195
  # @param [Mixed] campaign - Id of a campaign or a Campaign object
206
196
  # @raise IllegalArgumentException - if a Campaign object or campaign id is not passed
207
197
  # @return [Boolean]
208
- def delete_email_campaign(access_token, campaign)
209
- campaign_id = get_argument_id(campaign, 'Campaign')
210
- Services::EmailMarketingService.delete_campaign(access_token, campaign_id)
198
+ def delete_email_campaign(campaign)
199
+ campaign_id = to_id(campaign, 'Campaign')
200
+ Services::EmailMarketingService.delete_campaign(campaign_id)
211
201
  end
212
202
 
213
203
 
214
204
  # Create a new campaign
215
- # @param [String] access_token - Constant Contact OAuth2 access token
216
205
  # @param [Campaign] campaign - Campaign to be created
217
206
  # @return [Campaign] - created campaign
218
- def add_email_campaign(access_token, campaign)
219
- Services::EmailMarketingService.add_campaign(access_token, campaign)
207
+ def add_email_campaign(campaign)
208
+ Services::EmailMarketingService.add_campaign(campaign)
220
209
  end
221
210
 
222
211
 
223
212
  # Update a specific campaign
224
- # @param [String] access_token - Constant Contact OAuth2 access token
225
213
  # @param [Campaign] campaign - Campaign to be updated
226
214
  # @return [Campaign] - updated campaign
227
- def update_email_campaign(access_token, campaign)
228
- Services::EmailMarketingService.update_campaign(access_token, campaign)
215
+ def update_email_campaign(campaign)
216
+ Services::EmailMarketingService.update_campaign(campaign)
229
217
  end
230
218
 
231
219
 
232
220
  # Schedule a campaign to be sent
233
- # @param [String] access_token - Constant Contact OAuth2 access token
234
221
  # @param [Mixed] campaign - Id of a campaign or a Campaign object
235
222
  # @param [Schedule] schedule - Schedule to be associated with the provided campaign
236
223
  # @return [Campaign] - updated campaign
237
- def add_email_campaign_schedule(access_token, campaign, schedule)
238
- campaign_id = get_argument_id(campaign, 'Campaign')
239
- Services::CampaignScheduleService.add_schedule(access_token, campaign_id, schedule)
224
+ def add_email_campaign_schedule(campaign, schedule)
225
+ campaign_id = to_id(campaign, 'Campaign')
226
+ Services::CampaignScheduleService.add_schedule(campaign_id, schedule)
240
227
  end
241
228
 
242
229
 
243
230
  # Get an array of schedules associated with a given campaign
244
- # @param [String] access_token - Constant Contact OAuth2 access token
245
231
  # @param [Mixed] campaign - Campaign id or Campaign object itself
246
232
  # @return [Array<Schedule>]
247
- def get_email_campaign_schedules(access_token, campaign)
248
- campaign_id = get_argument_id(campaign, 'Campaign')
249
- Services::CampaignScheduleService.get_schedules(access_token, campaign_id)
233
+ def get_email_campaign_schedules(campaign)
234
+ campaign_id = to_id(campaign, 'Campaign')
235
+ Services::CampaignScheduleService.get_schedules(campaign_id)
250
236
  end
251
237
 
252
238
 
253
239
  # Get a specific schedule associated with a given campaign
254
- # @param [String] access_token - Constant Contact OAuth2 access token
255
240
  # @param [Mixed] campaign - Campaign id or Campaign object itself
256
241
  # @param [Mixed] schedule - Schedule id or Schedule object itself
257
242
  # @raise IllegalArgumentException
258
243
  # @return [Schedule]
259
- def get_email_campaign_schedule(access_token, campaign, schedule)
260
- campaign_id = get_argument_id(campaign, 'Campaign')
261
- schedule_id = get_argument_id(schedule, 'Schedule')
262
- Services::CampaignScheduleService.get_schedule(access_token, campaign_id, schedule_id)
244
+ def get_email_campaign_schedule(campaign, schedule)
245
+ campaign_id = to_id(campaign, 'Campaign')
246
+ schedule_id = to_id(schedule, 'Schedule')
247
+ Services::CampaignScheduleService.get_schedule(campaign_id, schedule_id)
263
248
  end
264
249
 
265
250
 
266
251
  # Update a specific schedule associated with a given campaign
267
- # @param [String] access_token - Constant Contact OAuth2 access token
268
252
  # @param [Mixed] campaign - Campaign id or Campaign object itself
269
253
  # @param [Schedule] schedule - Schedule to be updated
270
254
  # @return [Schedule]
271
- def update_email_campaign_schedule(access_token, campaign, schedule)
272
- campaign_id = get_argument_id(campaign, 'Campaign')
273
- Services::CampaignScheduleService.update_schedule(access_token, campaign_id, schedule)
255
+ def update_email_campaign_schedule(campaign, schedule)
256
+ campaign_id = to_id(campaign, 'Campaign')
257
+ Services::CampaignScheduleService.update_schedule(campaign_id, schedule)
274
258
  end
275
259
 
276
260
 
277
261
  # Delete a specific schedule associated with a given campaign
278
- # @param [String] access_token - Constant Contact OAuth2 access token
279
262
  # @param [Mixed] campaign - Campaign id or Campaign object itself
280
263
  # @param [Mixed] schedule - Schedule id or Schedule object itself
281
264
  # @raise IllegalArgumentException
282
265
  # @return [Boolean]
283
- def delete_email_campaign_schedule(access_token, campaign, schedule)
284
- campaign_id = get_argument_id(campaign, 'Campaign')
285
- schedule_id = get_argument_id(schedule, 'Schedule')
286
- Services::CampaignScheduleService.delete_schedule(access_token, campaign_id, schedule_id)
266
+ def delete_email_campaign_schedule(campaign, schedule)
267
+ campaign_id = to_id(campaign, 'Campaign')
268
+ schedule_id = to_id(schedule, 'Schedule')
269
+ Services::CampaignScheduleService.delete_schedule(campaign_id, schedule_id)
287
270
  end
288
271
 
289
272
 
290
273
  # Send a test send of a campaign
291
- # @param [String] access_token - Constant Contact OAuth2 access token
292
274
  # @param [Mixed] campaign - Campaign id or Campaign object itself
293
275
  # @param [TestSend] test_send - test send details
294
276
  # @return [TestSend]
295
- def send_email_campaign_test(access_token, campaign, test_send)
296
- campaign_id = get_argument_id(campaign, 'Campaign')
297
- Services::CampaignScheduleService.send_test(access_token, campaign_id, test_send)
277
+ def send_email_campaign_test(campaign, test_send)
278
+ campaign_id = to_id(campaign, 'Campaign')
279
+ Services::CampaignScheduleService.send_test(campaign_id, test_send)
298
280
  end
299
281
 
300
282
 
301
283
  # Get sends for a campaign
302
- # @param [String] access_token - Constant Contact OAuth2 access token
303
284
  # @param [Mixed] campaign - Campaign id or Campaign object itself
304
285
  # @param [Hash] params - hash of query parameters and values to append to the request.
305
286
  # Allowed parameters include:
@@ -307,14 +288,13 @@ module ConstantContact
307
288
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
308
289
  # next - the next link returned from a previous paginated call. May only be used by itself.
309
290
  # @return [ResultSet<SendActivity>]
310
- def get_email_campaign_sends(access_token, campaign, params = {})
311
- campaign_id = get_argument_id(campaign, 'Campaign')
312
- Services::CampaignTrackingService.get_sends(access_token, campaign_id, params)
291
+ def get_email_campaign_sends(campaign, params = {})
292
+ campaign_id = to_id(campaign, 'Campaign')
293
+ Services::CampaignTrackingService.get_sends(campaign_id, params)
313
294
  end
314
295
 
315
296
 
316
297
  # Get bounces for a campaign
317
- # @param [String] access_token - Constant Contact OAuth2 access token
318
298
  # @param [Mixed] campaign - Campaign id or Campaign object itself
319
299
  # @param [Hash] params - hash of query parameters and values to append to the request.
320
300
  # Allowed parameters include:
@@ -322,14 +302,13 @@ module ConstantContact
322
302
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
323
303
  # next - the next link returned from a previous paginated call. May only be used by itself.
324
304
  # @return [ResultSet<BounceActivity>]
325
- def get_email_campaign_bounces(access_token, campaign, params = {})
326
- campaign_id = get_argument_id(campaign, 'Campaign')
327
- Services::CampaignTrackingService.get_bounces(access_token, campaign_id, params)
305
+ def get_email_campaign_bounces(campaign, params = {})
306
+ campaign_id = to_id(campaign, 'Campaign')
307
+ Services::CampaignTrackingService.get_bounces(campaign_id, params)
328
308
  end
329
309
 
330
310
 
331
311
  # Get clicks for a campaign
332
- # @param [String] access_token - Constant Contact OAuth2 access token
333
312
  # @param [Mixed] campaign - Campaign id or Campaign object itself
334
313
  # @param [Hash] params - hash of query parameters and values to append to the request.
335
314
  # Allowed parameters include:
@@ -337,14 +316,13 @@ module ConstantContact
337
316
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
338
317
  # next - the next link returned from a previous paginated call. May only be used by itself.
339
318
  # @return [ResultSet<ClickActivity>]
340
- def get_email_campaign_clicks(access_token, campaign, params = {})
341
- campaign_id = get_argument_id(campaign, 'Campaign')
342
- Services::CampaignTrackingService.get_clicks(access_token, campaign_id, params)
319
+ def get_email_campaign_clicks(campaign, params = {})
320
+ campaign_id = to_id(campaign, 'Campaign')
321
+ Services::CampaignTrackingService.get_clicks(campaign_id, params)
343
322
  end
344
323
 
345
324
 
346
325
  # Get opens for a campaign
347
- # @param [String] access_token - Constant Contact OAuth2 access token
348
326
  # @param [Mixed] campaign - Campaign id or Campaign object itself
349
327
  # @param [Hash] params - hash of query parameters and values to append to the request.
350
328
  # Allowed parameters include:
@@ -352,14 +330,13 @@ module ConstantContact
352
330
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
353
331
  # next - the next link returned from a previous paginated call. May only be used by itself.
354
332
  # @return [ResultSet<OpenActivity>]
355
- def get_email_campaign_opens(access_token, campaign, params = {})
356
- campaign_id = get_argument_id(campaign, 'Campaign')
357
- Services::CampaignTrackingService.get_opens(access_token, campaign_id, params)
333
+ def get_email_campaign_opens(campaign, params = {})
334
+ campaign_id = to_id(campaign, 'Campaign')
335
+ Services::CampaignTrackingService.get_opens(campaign_id, params)
358
336
  end
359
337
 
360
338
 
361
339
  # Get forwards for a campaign
362
- # @param [String] access_token - Constant Contact OAuth2 access token
363
340
  # @param [Mixed] campaign - Campaign id or Campaign object itself
364
341
  # @param [Hash] params - hash of query parameters and values to append to the request.
365
342
  # Allowed parameters include:
@@ -367,14 +344,13 @@ module ConstantContact
367
344
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
368
345
  # next - the next link returned from a previous paginated call. May only be used by itself.
369
346
  # @return [ResultSet<ForwardActivity>]
370
- def get_email_campaign_forwards(access_token, campaign, params = {})
371
- campaign_id = get_argument_id(campaign, 'Campaign')
372
- Services::CampaignTrackingService.get_forwards(access_token, campaign_id, params)
347
+ def get_email_campaign_forwards(campaign, params = {})
348
+ campaign_id = to_id(campaign, 'Campaign')
349
+ Services::CampaignTrackingService.get_forwards(campaign_id, params)
373
350
  end
374
351
 
375
352
 
376
353
  # Get unsubscribes for a campaign
377
- # @param [String] access_token - Constant Contact OAuth2 access token
378
354
  # @param [Mixed] campaign - Campaign id or Campaign object itself
379
355
  # @param [Hash] params - hash of query parameters and values to append to the request.
380
356
  # Allowed parameters include:
@@ -382,24 +358,22 @@ module ConstantContact
382
358
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
383
359
  # next - the next link returned from a previous paginated call. May only be used by itself.
384
360
  # @return [ResultSet<UnsubscribeActivity>] - Containing a results array of UnsubscribeActivity
385
- def get_email_campaign_unsubscribes(access_token, campaign, params = {})
386
- campaign_id = get_argument_id(campaign, 'Campaign')
387
- Services::CampaignTrackingService.get_unsubscribes(access_token, campaign_id, params)
361
+ def get_email_campaign_unsubscribes(campaign, params = {})
362
+ campaign_id = to_id(campaign, 'Campaign')
363
+ Services::CampaignTrackingService.get_unsubscribes(campaign_id, params)
388
364
  end
389
365
 
390
366
 
391
367
  # Get a reporting summary for a campaign
392
- # @param [String] access_token - Constant Contact OAuth2 access token
393
368
  # @param [Mixed] campaign - Campaign id or Campaign object itself
394
369
  # @return [TrackingSummary]
395
- def get_email_campaign_summary_report(access_token, campaign)
396
- campaign_id = get_argument_id(campaign, 'Campaign')
397
- Services::CampaignTrackingService.get_summary(access_token, campaign_id)
370
+ def get_email_campaign_summary_report(campaign)
371
+ campaign_id = to_id(campaign, 'Campaign')
372
+ Services::CampaignTrackingService.get_summary(campaign_id)
398
373
  end
399
374
 
400
375
 
401
376
  # Get sends for a Contact
402
- # @param [String] access_token - Constant Contact OAuth2 access token
403
377
  # @param [Mixed] contact - Contact id or Contact object itself
404
378
  # @param [Hash] params - hash of query parameters and values to append to the request.
405
379
  # Allowed parameters include:
@@ -407,14 +381,13 @@ module ConstantContact
407
381
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
408
382
  # next - the next link returned from a previous paginated call. May only be used by itself.
409
383
  # @return [ResultSet<SendActivity>]
410
- def get_contact_sends(access_token, contact, params = {})
411
- contact_id = get_argument_id(contact, 'Contact')
412
- Services::ContactTrackingService.get_sends(access_token, contact_id, params)
384
+ def get_contact_sends(contact, params = {})
385
+ contact_id = to_id(contact, 'Contact')
386
+ Services::ContactTrackingService.get_sends(contact_id, params)
413
387
  end
414
388
 
415
389
 
416
390
  # Get bounces for a Contact
417
- # @param [String] access_token - Constant Contact OAuth2 access token
418
391
  # @param [Mixed] contact - Contact id or Contact object itself
419
392
  # @param [Hash] params - hash of query parameters and values to append to the request.
420
393
  # Allowed parameters include:
@@ -422,14 +395,13 @@ module ConstantContact
422
395
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
423
396
  # next - the next link returned from a previous paginated call. May only be used by itself.
424
397
  # @return [ResultSet<BounceActivity>]
425
- def get_contact_bounces(access_token, contact, params = {})
426
- contact_id = get_argument_id(contact, 'Contact')
427
- Services::ContactTrackingService.get_bounces(access_token, contact_id, params)
398
+ def get_contact_bounces(contact, params = {})
399
+ contact_id = to_id(contact, 'Contact')
400
+ Services::ContactTrackingService.get_bounces(contact_id, params)
428
401
  end
429
402
 
430
403
 
431
404
  # Get clicks for a Contact
432
- # @param [String] access_token - Constant Contact OAuth2 access token
433
405
  # @param [Mixed] contact - Contact id or Contact object itself
434
406
  # @param [Hash] params - hash of query parameters and values to append to the request.
435
407
  # Allowed parameters include:
@@ -437,14 +409,13 @@ module ConstantContact
437
409
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
438
410
  # next - the next link returned from a previous paginated call. May only be used by itself.
439
411
  # @return [ResultSet<ClickActivity>]
440
- def get_contact_clicks(access_token, contact, params = {})
441
- contact_id = get_argument_id(contact, 'Contact')
442
- Services::ContactTrackingService.get_clicks(access_token, contact_id, params)
412
+ def get_contact_clicks(contact, params = {})
413
+ contact_id = to_id(contact, 'Contact')
414
+ Services::ContactTrackingService.get_clicks(contact_id, params)
443
415
  end
444
416
 
445
417
 
446
418
  # Get opens for a Contact
447
- # @param [String] access_token - Constant Contact OAuth2 access token
448
419
  # @param [Mixed] contact - Contact id or Contact object itself
449
420
  # @param [Hash] params - hash of query parameters and values to append to the request.
450
421
  # Allowed parameters include:
@@ -452,14 +423,13 @@ module ConstantContact
452
423
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
453
424
  # next - the next link returned from a previous paginated call. May only be used by itself.
454
425
  # @return [ResultSet<OpenActivity>]
455
- def get_contact_opens(access_token, contact, params = {})
456
- contact_id = get_argument_id(contact, 'Contact')
457
- Services::ContactTrackingService.get_opens(access_token, contact_id, params)
426
+ def get_contact_opens(contact, params = {})
427
+ contact_id = to_id(contact, 'Contact')
428
+ Services::ContactTrackingService.get_opens(contact_id, params)
458
429
  end
459
430
 
460
431
 
461
432
  # Get forwards for a Contact
462
- # @param [String] access_token - Constant Contact OAuth2 access token
463
433
  # @param [Mixed] contact - Contact id or Contact object itself
464
434
  # @param [Hash] params - hash of query parameters and values to append to the request.
465
435
  # Allowed parameters include:
@@ -467,14 +437,13 @@ module ConstantContact
467
437
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
468
438
  # next - the next link returned from a previous paginated call. May only be used by itself.
469
439
  # @return [ResultSet<ForwardActivity>]
470
- def get_contact_forwards(access_token, contact, params = {})
471
- contact_id = get_argument_id(contact, 'Contact')
472
- Services::ContactTrackingService.get_forwards(access_token, contact_id, params)
440
+ def get_contact_forwards(contact, params = {})
441
+ contact_id = to_id(contact, 'Contact')
442
+ Services::ContactTrackingService.get_forwards(contact_id, params)
473
443
  end
474
444
 
475
445
 
476
446
  # Get unsubscribes for a Contact
477
- # @param [String] access_token - Constant Contact OAuth2 access token
478
447
  # @param [Mixed] contact - Contact id or Contact object itself
479
448
  # @param [Hash] params - hash of query parameters and values to append to the request.
480
449
  # Allowed parameters include:
@@ -482,386 +451,347 @@ module ConstantContact
482
451
  # created_since - Used to retrieve a list of events since the date and time specified (in ISO-8601 format).
483
452
  # next - the next link returned from a previous paginated call. May only be used by itself.
484
453
  # @return [UnsubscribeActivity] - Containing a results array of UnsubscribeActivity
485
- def get_contact_unsubscribes(access_token, contact, params = {})
486
- contact_id = get_argument_id(contact, 'Contact')
487
- Services::ContactTrackingService.get_unsubscribes(access_token, contact_id, params)
454
+ def get_contact_unsubscribes(contact, params = {})
455
+ contact_id = to_id(contact, 'Contact')
456
+ Services::ContactTrackingService.get_unsubscribes(contact_id, params)
488
457
  end
489
458
 
490
459
 
491
460
  # Get a reporting summary for a Contact
492
- # @param [String] access_token - Constant Contact OAuth2 access token
493
461
  # @param [Mixed] contact - Contact id or Contact object itself
494
462
  # @return [TrackingSummary]
495
- def get_contact_summary_report(access_token, contact)
496
- contact_id = get_argument_id(contact, 'Contact')
497
- Services::ContactTrackingService.get_summary(access_token, contact_id)
463
+ def get_contact_summary_report(contact)
464
+ contact_id = to_id(contact, 'Contact')
465
+ Services::ContactTrackingService.get_summary(contact_id)
498
466
  end
499
467
 
500
468
 
501
469
  # Get an array of activities
502
- # @param [String] access_token - Constant Contact OAuth2 access token
503
470
  # @param [Hash] params - hash of query parameters and values to append to the request.
504
471
  # Allowed parameters include:
505
472
  # status - Status of the activity, must be one of UNCONFIRMED, PENDING, QUEUED, RUNNING, COMPLETE, ERROR
506
473
  # type - Type of activity, must be one of ADD_CONTACTS, REMOVE_CONTACTS_FROM_LISTS, CLEAR_CONTACTS_FROM_LISTS,
507
474
  # EXPORT_CONTACTS
508
475
  # @return [Array<Activity>]
509
- def get_activities(access_token, params = {})
510
- Services::ActivityService.get_activities(access_token, params)
476
+ def get_activities(params = {})
477
+ Services::ActivityService.get_activities(params)
511
478
  end
512
479
 
513
480
 
514
481
  # Get a single activity by id
515
- # @param [String] access_token - Constant Contact OAuth2 access token
516
482
  # @param [String] activity_id - Activity id
517
483
  # @return [Activity]
518
- def get_activity(access_token, activity_id)
519
- Services::ActivityService.get_activity(access_token, activity_id)
484
+ def get_activity(activity_id)
485
+ Services::ActivityService.get_activity(activity_id)
520
486
  end
521
487
 
522
488
 
523
489
  # Add an AddContacts activity to add contacts in bulk
524
- # @param [String] access_token - Constant Contact OAuth2 access token
525
490
  # @param [AddContacts] add_contacts - Add Contacts Activity
526
491
  # @return [Activity]
527
- def add_create_contacts_activity(access_token, add_contacts)
528
- Services::ActivityService.create_add_contacts_activity(access_token, add_contacts)
492
+ def add_create_contacts_activity(add_contacts)
493
+ Services::ActivityService.create_add_contacts_activity(add_contacts)
529
494
  end
530
495
 
531
496
 
532
497
  # Create an Add Contacts Activity from a file. Valid file types are txt, csv, xls, xlsx
533
- # @param [String] access_token - Constant Contact OAuth2 access token
534
498
  # @param [String] file_name - The name of the file (ie: contacts.csv)
535
499
  # @param [String] contents - The content of the file
536
500
  # @param [String] lists - Comma separated list of ContactList id's to add the contacts to
537
501
  # @return [Activity]
538
- def add_create_contacts_activity_from_file(access_token, file_name, contents, lists)
539
- Services::ActivityService.create_add_contacts_activity_from_file(access_token, file_name, contents, lists)
502
+ def add_create_contacts_activity_from_file(file_name, contents, lists)
503
+ Services::ActivityService.create_add_contacts_activity_from_file(file_name, contents, lists)
540
504
  end
541
505
 
542
506
 
543
507
  # Add a ClearLists Activity to remove all contacts from the provided lists
544
- # @param [String] access_token - Constant Contact OAuth2 access token
545
508
  # @param [Array<Lists>] lists - Add Contacts Activity
546
509
  # @return [Activity]
547
- def add_clear_lists_activity(access_token, lists)
548
- Services::ActivityService.add_clear_lists_activity(access_token, lists)
510
+ def add_clear_lists_activity(lists)
511
+ Services::ActivityService.add_clear_lists_activity(lists)
549
512
  end
550
513
 
551
514
 
552
515
  # Add a Remove Contacts From Lists Activity
553
- # @param [String] access_token - Constant Contact OAuth2 access token
554
516
  # @param [Array<EmailAddress>] email_addresses - email addresses to be removed
555
517
  # @param [Array<Lists>] lists - lists to remove the provided email addresses from
556
518
  # @return [Activity]
557
- def add_remove_contacts_from_lists_activity(access_token, email_addresses, lists)
558
- Services::ActivityService.add_remove_contacts_from_lists_activity(access_token, email_addresses, lists)
519
+ def add_remove_contacts_from_lists_activity(email_addresses, lists)
520
+ Services::ActivityService.add_remove_contacts_from_lists_activity(email_addresses, lists)
559
521
  end
560
522
 
561
523
 
562
524
  # Add a Remove Contacts From Lists Activity from a file. Valid file types are txt, csv, xls, xlsx
563
- # @param [String] access_token - Constant Contact OAuth2 access token
564
525
  # @param [String] file_name - The name of the file (ie: contacts.csv)
565
526
  # @param [String] contents - The content of the file
566
527
  # @param [String] lists - Comma separated list of ContactList id' to add the contacts too
567
528
  # @return [Activity]
568
- def add_remove_contacts_from_lists_activity_from_file(access_token, file_name, contents, lists)
569
- Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(access_token, file_name, contents, lists)
529
+ def add_remove_contacts_from_lists_activity_from_file(file_name, contents, lists)
530
+ Services::ActivityService.add_remove_contacts_from_lists_activity_from_file(file_name, contents, lists)
570
531
  end
571
532
 
572
533
 
573
534
  # Create an Export Contacts Activity
574
- # @param [String] access_token - Constant Contact OAuth2 access token
575
535
  # @param [<Array>Contacts] export_contacts - Contacts to be exported
576
536
  # @return [Activity]
577
- def add_export_contacts_activity(access_token, export_contacts)
578
- Services::ActivityService.add_export_contacts_activity(access_token, export_contacts)
537
+ def add_export_contacts_activity(export_contacts)
538
+ Services::ActivityService.add_export_contacts_activity(export_contacts)
579
539
  end
580
540
 
581
541
 
582
542
  # Get a list of events
583
- # @param [String] access_token - Constant Contact OAuth2 access token
584
543
  # @return [ResultSet<Event>]
585
- def get_events(access_token)
586
- Services::EventSpotService.get_events(access_token)
544
+ def get_events()
545
+ Services::EventSpotService.get_events()
587
546
  end
588
547
 
589
548
 
590
549
  # Get an event
591
- # @param [String] access_token - Constant Contact OAuth2 access token
592
550
  # @param [Event] event - event id or object to be retrieved
593
551
  # @return [Event]
594
- def get_event(access_token, event)
595
- Services::EventSpotService.get_event(access_token, event)
552
+ def get_event(event)
553
+ Services::EventSpotService.get_event(event)
596
554
  end
597
555
 
598
556
 
599
557
  # Create an event
600
- # @param [String] access_token - Constant Contact OAuth2 access token
601
558
  # @param [Hash] event - Event data stored in an object which respods to to_json
602
559
  # @return [Event]
603
- def add_event(access_token, event)
604
- Services::EventSpotService.add_event(access_token, event)
560
+ def add_event(event)
561
+ Services::EventSpotService.add_event(event)
605
562
  end
606
563
 
607
564
 
608
565
  # Update an event
609
- # @param [String] access_token - Constant Contact OAuth2 access token
610
566
  # @param [Event|Hash] event - Event details stored in an object that responds to to_json and has an :id attribute
611
567
  # @return [Event]
612
- def update_event(access_token, event)
613
- Services::EventSpotService.update_event(access_token, event)
568
+ def update_event(event)
569
+ Services::EventSpotService.update_event(event)
614
570
  end
615
571
 
616
572
 
617
573
  # Publish an event
618
- # @param [String] access_token - Constant Contact OAuth2 access token
619
574
  # @param [Event] event - Event to publish
620
575
  # @return [Event]
621
- def publish_event(access_token, event)
622
- Services::EventSpotService.publish_event(access_token, event)
576
+ def publish_event(event)
577
+ Services::EventSpotService.publish_event(event)
623
578
  end
624
579
 
625
580
 
626
581
  # Cancel an event
627
- # @param [String] access_token - Constant Contact OAuth2 access token
628
582
  # @param [Event] event - Event to cancel
629
583
  # @return [Event]
630
- def cancel_event(access_token, event)
631
- Services::EventSpotService.cancel_event(access_token, event)
584
+ def cancel_event(event)
585
+ Services::EventSpotService.cancel_event(event)
632
586
  end
633
587
 
634
588
 
635
589
  # Get a list of event fees
636
- # @param [String] access_token - Constant Contact OAuth2 access token
637
590
  # @param [Event] event - Event to get fees of
638
591
  # @return [<Array>EventFee]
639
- def get_event_fees(access_token, event)
640
- Services::EventSpotService.get_fees(access_token, event)
592
+ def get_event_fees(event)
593
+ Services::EventSpotService.get_fees(event)
641
594
  end
642
595
 
643
596
 
644
597
  # Get an event fee
645
- # @param [String] access_token - Constant Contact OAuth2 access token
646
598
  # @param [Event] event - Event fee corresponds to
647
599
  # @param [EventFee] fee - Fee to retrieve
648
600
  # @return [EventFee]
649
- def get_event_fee(access_token, event, fee)
650
- Services::EventSpotService.get_fee(access_token, event, fee)
601
+ def get_event_fee(event, fee)
602
+ Services::EventSpotService.get_fee(event, fee)
651
603
  end
652
604
 
653
605
 
654
606
  # Create an event fee
655
- # @param [String] access_token - Constant Contact OAuth2 access token
656
607
  # @param [Event] event - Event fee corresponds to
657
608
  # @param [Hash] fee - Fee details
658
609
  # @return [EventFee]
659
- def add_event_fee(access_token, event, fee)
660
- Services::EventSpotService.add_fee(access_token, event, fee)
610
+ def add_event_fee(event, fee)
611
+ Services::EventSpotService.add_fee(event, fee)
661
612
  end
662
613
 
663
614
 
664
615
  # Update an event fee
665
- # @param [String] access_token - Constant Contact OAuth2 access token
666
616
  # @param [Event] event - Event fee corresponds to
667
617
  # @param [EventFee] fee - Fee details
668
618
  # @return [EventFee]
669
- def update_event_fee(access_token, event, fee)
670
- Services::EventSpotService.update_fee(access_token, event, fee)
619
+ def update_event_fee(event, fee)
620
+ Services::EventSpotService.update_fee(event, fee)
671
621
  end
672
622
 
673
623
 
674
624
  # Delete an event fee
675
- # @param [String] access_token - Constant Contact OAuth2 access token
676
625
  # @param [Event] event - Event fee corresponds to
677
626
  # @param [EventFee] fee - Fee details
678
627
  # @return [Boolean]
679
- def delete_event_fee(access_token, event, fee)
680
- Services::EventSpotService.delete_fee(access_token, event, fee)
628
+ def delete_event_fee(event, fee)
629
+ Services::EventSpotService.delete_fee(event, fee)
681
630
  end
682
631
 
683
632
 
684
633
  # Get a set of event registrants
685
- # @param [String] access_token - Constant Contact OAuth2 access token
686
634
  # @param [Event] event - Event fee corresponds to
687
635
  # @return [ResultSet<Registrant>]
688
- def get_event_registrants(access_token, event)
689
- Services::EventSpotService.get_registrants(access_token, event)
636
+ def get_event_registrants(event)
637
+ Services::EventSpotService.get_registrants(event)
690
638
  end
691
639
 
692
640
 
693
641
  # Get an event registrant
694
- # @param [String] access_token - Constant Contact OAuth2 access token
695
642
  # @param [Event] event - Event registrant corresponds to
696
643
  # @param [Registrant] registrant - registrant details
697
644
  # @return [Registrant]
698
- def get_event_registrant(access_token, event, registrant)
699
- Services::EventSpotService.get_registrant(access_token, event, registrant)
645
+ def get_event_registrant(event, registrant)
646
+ Services::EventSpotService.get_registrant(event, registrant)
700
647
  end
701
648
 
702
649
 
703
650
  # Get an array of event items for an individual event
704
- # @param [String] access_token - Constant Contact OAuth2 access token
705
651
  # @param [Integer] event_id - event id to retrieve items for
706
652
  # @return [Array<EventItem>]
707
- def get_event_items(access_token, event_id)
708
- Services::EventSpotService.get_event_items(access_token, event_id)
653
+ def get_event_items(event_id)
654
+ Services::EventSpotService.get_event_items(event_id)
709
655
  end
710
656
 
711
657
 
712
658
  # Get an individual event item
713
- # @param [String] access_token - Constant Contact OAuth2 access token
714
659
  # @param [Integer] event_id - id of event to retrieve item for
715
660
  # @param [Integer] item_id - id of item to be retrieved
716
661
  # @return [EventItem]
717
- def get_event_item(access_token, event_id, item_id)
718
- Services::EventSpotService.get_event_item(access_token, event_id, item_id)
662
+ def get_event_item(event_id, item_id)
663
+ Services::EventSpotService.get_event_item(event_id, item_id)
719
664
  end
720
665
 
721
666
 
722
667
  # Create a new event item for an event
723
- # @param [String] access_token - Constant Contact OAuth2 access token
724
668
  # @param [Integer] event_id - id of event to be associated with the event item
725
669
  # @param [EventItem] event_item - event item to be created
726
670
  # @return [EventItem]
727
- def add_event_item(access_token, event_id, event_item)
728
- Services::EventSpotService.add_event_item(access_token, event_id, event_item)
671
+ def add_event_item(event_id, event_item)
672
+ Services::EventSpotService.add_event_item(event_id, event_item)
729
673
  end
730
674
 
731
675
 
732
676
  # Delete a specific event item for an event
733
- # @param [String] access_token - Constant Contact OAuth2 access token
734
677
  # @param [Integer] event_id - id of event to delete an event item for
735
678
  # @param [Integer] item_id - id of event item to be deleted
736
679
  # @return [Boolean]
737
- def delete_event_item(access_token, event_id, item_id)
738
- Services::EventSpotService.delete_event_item(access_token, event_id, item_id)
680
+ def delete_event_item(event_id, item_id)
681
+ Services::EventSpotService.delete_event_item(event_id, item_id)
739
682
  end
740
683
 
741
684
 
742
685
  # Update a specific event item for an event
743
- # @param [String] access_token - Constant Contact OAuth2 access token
744
686
  # @param [Integer] event_id - id of event associated with the event item
745
687
  # @param [EventItem] event_item - event item to be updated
746
688
  # @return [EventItem]
747
- def update_event_item(access_token, event_id, event_item)
748
- Services::EventSpotService.update_event_item(access_token, event_id, event_item)
689
+ def update_event_item(event_id, event_item)
690
+ Services::EventSpotService.update_event_item(event_id, event_item)
749
691
  end
750
692
 
751
693
 
752
694
  # Get an array of attributes for an individual event item
753
- # @param [String] access_token - Constant Contact OAuth2 access token
754
695
  # @param [Integer] event_id - event id to retrieve item for
755
696
  # @param [Integer] item_id - event item id to retrieve attributes for
756
697
  # @return [Array<EventItemAttribute>]
757
- def get_event_item_attributes(access_token, event_id, item_id)
758
- Services::EventSpotService.get_event_item_attributes(access_token, event_id, item_id)
698
+ def get_event_item_attributes(event_id, item_id)
699
+ Services::EventSpotService.get_event_item_attributes(event_id, item_id)
759
700
  end
760
701
 
761
702
 
762
703
  # Get an individual event item attribute
763
- # @param [String] access_token - Constant Contact OAuth2 access token
764
704
  # @param [Integer] event_id - id of event to retrieve item for
765
705
  # @param [Integer] item_id - id of item to retrieve attribute for
766
706
  # @param [Integer] attribute_id - id of attribute to be retrieved
767
707
  # @return [EventItemAttribute]
768
- def get_event_item_attribute(access_token, event_id, item_id, attribute_id)
769
- Services::EventSpotService.get_event_item_attribute(access_token, event_id, item_id, attribute_id)
708
+ def get_event_item_attribute(event_id, item_id, attribute_id)
709
+ Services::EventSpotService.get_event_item_attribute(event_id, item_id, attribute_id)
770
710
  end
771
711
 
772
712
 
773
713
  # Create a new event item attribute for an event item
774
- # @param [String] access_token - Constant Contact OAuth2 access token
775
714
  # @param [Integer] event_id - id of event to be associated with the event item attribute
776
715
  # @param [Integer] item_id - id of event item to be associated with the event item attribute
777
716
  # @param [EventItemAttribute] event_item_attribute - event item attribute to be created
778
717
  # @return [EventItemAttribute]
779
- def add_event_item_attribute(access_token, event_id, item_id, event_item_attribute)
780
- Services::EventSpotService.add_event_item_attribute(access_token, event_id, item_id, event_item_attribute)
718
+ def add_event_item_attribute(event_id, item_id, event_item_attribute)
719
+ Services::EventSpotService.add_event_item_attribute(event_id, item_id, event_item_attribute)
781
720
  end
782
721
 
783
722
 
784
723
  # Delete a specific event item for an event
785
- # @param [String] access_token - Constant Contact OAuth2 access token
786
724
  # @param [Integer] event_id - id of event to delete an event item attribute for
787
725
  # @param [Integer] item_id - id of event item to delete an event item attribute for
788
726
  # @param [Integer] attribute_id - id of attribute to be deleted
789
727
  # @return [Boolean]
790
- def delete_event_item_attribute(access_token, event_id, item_id, attribute_id)
791
- Services::EventSpotService.delete_event_item_attribute(access_token, event_id, item_id, attribute_id)
728
+ def delete_event_item_attribute(event_id, item_id, attribute_id)
729
+ Services::EventSpotService.delete_event_item_attribute(event_id, item_id, attribute_id)
792
730
  end
793
731
 
794
732
 
795
733
  # Update a specific event item attribute for an event item
796
- # @param [String] access_token - Constant Contact OAuth2 access token
797
734
  # @param [Integer] event_id - id of event associated with the event item
798
735
  # @param [Integer] item_id - id of event item associated with the event item attribute
799
736
  # @param [EventItemAttribute] event_item_attribute - event item to be updated
800
737
  # @return [EventItemAttribute]
801
- def update_event_item_attribute(access_token, event_id, item_id, event_item_attribute)
802
- Services::EventSpotService.update_event_item_attribute(access_token, event_id, item_id, event_item_attribute)
738
+ def update_event_item_attribute(event_id, item_id, event_item_attribute)
739
+ Services::EventSpotService.update_event_item_attribute(event_id, item_id, event_item_attribute)
803
740
  end
804
741
 
805
742
 
806
743
  # Get an array of promocodes for an individual event
807
- # @param [String] access_token - Constant Contact OAuth2 access token
808
744
  # @param [Integer] event_id - event id to retrieve promocodes for
809
745
  # @return [Array<Promocode>]
810
- def get_promocodes(access_token, event_id)
811
- Services::EventSpotService.get_promocodes(access_token, event_id)
746
+ def get_promocodes(event_id)
747
+ Services::EventSpotService.get_promocodes(event_id)
812
748
  end
813
749
 
814
750
 
815
751
  # Get an individual promocode
816
- # @param [String] access_token - Constant Contact OAuth2 access token
817
752
  # @param [Integer] event_id - id of event to retrieve item for
818
753
  # @param [Integer] promocode_id - id of item to be retrieved
819
754
  # @return [Promocode]
820
- def get_promocode(access_token, event_id, promocode_id)
821
- Services::EventSpotService.get_promocode(access_token, event_id, promocode_id)
755
+ def get_promocode(event_id, promocode_id)
756
+ Services::EventSpotService.get_promocode(event_id, promocode_id)
822
757
  end
823
758
 
824
759
 
825
760
  # Create a new promocode for an event
826
- # @param [String] access_token - Constant Contact OAuth2 access token
827
761
  # @param [Integer] event_id - id of event to be associated with the promocode
828
762
  # @param [Promocode] promocode - promocode to be created
829
763
  # @return [Promocode]
830
- def add_promocode(access_token, event_id, promocode)
831
- Services::EventSpotService.add_promocode(access_token, event_id, promocode)
764
+ def add_promocode(event_id, promocode)
765
+ Services::EventSpotService.add_promocode(event_id, promocode)
832
766
  end
833
767
 
834
768
 
835
769
  # Delete a specific promocode for an event
836
- # @param [String] access_token - Constant Contact OAuth2 access token
837
770
  # @param [Integer] event_id - id of event to delete a promocode for
838
771
  # @param [Integer] promocode_id - id of promocode to be deleted
839
772
  # @return [Boolean]
840
- def delete_promocode(access_token, event_id, promocode_id)
841
- Services::EventSpotService.delete_promocode(access_token, event_id, promocode_id)
773
+ def delete_promocode(event_id, promocode_id)
774
+ Services::EventSpotService.delete_promocode(event_id, promocode_id)
842
775
  end
843
776
 
844
777
 
845
778
  # Update a specific promocode for an event
846
- # @param [String] access_token - Constant Contact OAuth2 access token
847
779
  # @param [Integer] event_id - id of event associated with the promocode
848
780
  # @param [Promocode] promocode - promocode to be updated
849
781
  # @return [Promocode]
850
- def update_promocode(access_token, event_id, promocode)
851
- Services::EventSpotService.update_promocode(access_token, event_id, promocode)
782
+ def update_promocode(event_id, promocode)
783
+ Services::EventSpotService.update_promocode(event_id, promocode)
852
784
  end
853
785
 
854
786
 
855
787
  # Retrieve MyLibrary usage information
856
- # @param [String] access_token - Constant Contact OAuth2 access token
857
788
  # @return [LibrarySummary]
858
- def get_library_info(access_token)
859
- Services::LibraryService.get_library_info(access_token)
789
+ def get_library_info()
790
+ Services::LibraryService.get_library_info()
860
791
  end
861
792
 
862
793
 
863
794
  # Retrieve a list of MyLibrary folders
864
- # @param [String] access_token - Constant Contact OAuth2 access token
865
795
  # @param [Hash] params - hash of query parameters and values to append to the request.
866
796
  # Allowed parameters include:
867
797
  # sort_by - The method to sort by, valid values are :
@@ -873,49 +803,44 @@ module ConstantContact
873
803
  # NAME_DESC - sorts alphabetically by folder name, z to a
874
804
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
875
805
  # @return [ResultSet<LibraryFolder>]
876
- def get_library_folders(access_token, params = {})
877
- Services::LibraryService.get_library_folders(access_token, params)
806
+ def get_library_folders(params = {})
807
+ Services::LibraryService.get_library_folders(params)
878
808
  end
879
809
 
880
810
 
881
811
  # Create a new MyLibrary folder
882
- # @param [String] access_token - Constant Contact OAuth2 access token
883
812
  # @param [LibraryFolder] folder - Library Folder to be created
884
813
  # @return [LibraryFolder]
885
- def add_library_folder(access_token, folder)
886
- Services::LibraryService.add_library_folder(access_token, folder)
814
+ def add_library_folder(folder)
815
+ Services::LibraryService.add_library_folder(folder)
887
816
  end
888
817
 
889
818
 
890
819
  # Retrieve a specific MyLibrary folder using the folder_id path parameter
891
- # @param [String] access_token - Constant Contact OAuth2 access token
892
820
  # @param [String] folder_id - The ID for the folder to return
893
821
  # @return [LibraryFolder]
894
- def get_library_folder(access_token, folder_id)
895
- Services::LibraryService.get_library_folder(access_token, folder_id)
822
+ def get_library_folder(folder_id)
823
+ Services::LibraryService.get_library_folder(folder_id)
896
824
  end
897
825
 
898
826
 
899
827
  # Update a specific MyLibrary folder
900
- # @param [String] access_token - Constant Contact OAuth2 access token
901
828
  # @param [LibraryFolder] folder - MyLibrary folder to be updated
902
829
  # @return [LibraryFolder]
903
- def update_library_folder(access_token, folder)
904
- Services::LibraryService.update_library_folder(access_token, folder)
830
+ def update_library_folder(folder)
831
+ Services::LibraryService.update_library_folder(folder)
905
832
  end
906
833
 
907
834
 
908
835
  # Delete a MyLibrary folder
909
- # @param [String] access_token - Constant Contact OAuth2 access token
910
836
  # @param [String] folder_id - The ID for the MyLibrary folder to delete
911
837
  # @return [Boolean]
912
- def delete_library_folder(access_token, folder_id)
913
- Services::LibraryService.delete_library_folder(access_token, folder_id)
838
+ def delete_library_folder(folder_id)
839
+ Services::LibraryService.delete_library_folder(folder_id)
914
840
  end
915
841
 
916
842
 
917
843
  # Retrieve all files in the Trash folder
918
- # @param [String] access_token - Constant Contact OAuth2 access token
919
844
  # @param [Hash] params - hash of query parameters and values to append to the request.
920
845
  # Allowed parameters include:
921
846
  # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
@@ -932,21 +857,19 @@ module ConstantContact
932
857
  # DIMENSION_DESC - sorts by file dimensions (hxw), largest to smallest
933
858
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
934
859
  # @return [ResultSet<LibraryFile>]
935
- def get_library_trash(access_token, params = {})
936
- Services::LibraryService.get_library_trash(access_token, params)
860
+ def get_library_trash(params = {})
861
+ Services::LibraryService.get_library_trash(params)
937
862
  end
938
863
 
939
864
 
940
865
  # Permanently deletes all files in the Trash folder
941
- # @param [String] access_token - Constant Contact OAuth2 access token
942
866
  # @return [Boolean]
943
- def delete_library_trash(access_token)
944
- Services::LibraryService.delete_library_trash(access_token)
867
+ def delete_library_trash()
868
+ Services::LibraryService.delete_library_trash()
945
869
  end
946
870
 
947
871
 
948
872
  # Retrieve a collection of Library files in the Constant Contact account
949
- # @param [String] access_token - Constant Contact OAuth2 access token
950
873
  # @param [Hash] params - hash of query parameters and values to append to the request.
951
874
  # Allowed parameters include:
952
875
  # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
@@ -960,34 +883,31 @@ module ConstantContact
960
883
  # Mobile
961
884
  # limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50.
962
885
  # @return [ResultSet<LibraryFile>]
963
- def get_library_files(access_token, params = {})
964
- Services::LibraryService.get_library_files(access_token, params)
886
+ def get_library_files(params = {})
887
+ Services::LibraryService.get_library_files(params)
965
888
  end
966
889
 
967
890
 
968
891
  # Retrieves all files from a MyLibrary folder specified by the folder_id path parameter
969
- # @param [String] access_token - Constant Contact OAuth2 access token
970
892
  # @param [String] folder_id - Specifies the folder from which to retrieve files
971
893
  # @param [Hash] params - hash of query parameters and values to append to the request.
972
894
  # Allowed parameters include:
973
895
  # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
974
896
  # @return [ResultSet<LibraryFile>]
975
- def get_library_files_by_folder(access_token, folder_id, params = {})
976
- Services::LibraryService.get_library_files_by_folder(access_token, folder_id, params)
897
+ def get_library_files_by_folder(folder_id, params = {})
898
+ Services::LibraryService.get_library_files_by_folder(folder_id, params)
977
899
  end
978
900
 
979
901
 
980
902
  # Retrieve a MyLibrary file using the file_id path parameter
981
- # @param [String] access_token - Constant Contact OAuth2 access token
982
903
  # @param [String] file_id - Specifies the MyLibrary file for which to retrieve information
983
904
  # @return [LibraryFile]
984
- def get_library_file(access_token, file_id)
985
- Services::LibraryService.get_library_file(access_token, file_id)
905
+ def get_library_file(file_id)
906
+ Services::LibraryService.get_library_file(file_id)
986
907
  end
987
908
 
988
909
 
989
910
  # Adds a new MyLibrary file using the multipart content-type
990
- # @param [String] access_token - Constant Contact OAuth2 access token
991
911
  # @param [String] file_name - The name of the file (ie: dinnerplate-special.jpg)
992
912
  # @param [String] folder_id - Folder id to add the file to
993
913
  # @param [String] description - The description of the file provided by user
@@ -998,49 +918,45 @@ module ConstantContact
998
918
  # @param [String] file_type - Specifies the file type, valid values are: JPEG, JPG, GIF, PDF, PNG
999
919
  # @param [String] contents - The content of the file
1000
920
  # @return [LibraryFile]
1001
- def add_library_file(access_token, file_name, folder_id, description, source, file_type, contents)
1002
- Services::LibraryService.add_library_file(access_token, file_name, folder_id, description, source, file_type, contents)
921
+ def add_library_file(file_name, folder_id, description, source, file_type, contents)
922
+ Services::LibraryService.add_library_file(file_name, folder_id, description, source, file_type, contents)
1003
923
  end
1004
924
 
1005
925
 
1006
926
  # Update information for a specific MyLibrary file
1007
- # @param [String] access_token - Constant Contact OAuth2 access token
1008
927
  # @param [LibraryFile] file - Library File to be updated
1009
928
  # @return [LibraryFile]
1010
- def update_library_file(access_token, file)
1011
- Services::LibraryService.update_library_file(access_token, file)
929
+ def update_library_file(file)
930
+ Services::LibraryService.update_library_file(file)
1012
931
  end
1013
932
 
1014
933
 
1015
934
  # Delete one or more MyLibrary files specified by the fileId path parameter;
1016
935
  # separate multiple file IDs with a comma.
1017
936
  # Deleted files are moved from their current folder into the system Trash folder, and its status is set to Deleted.
1018
- # @param [String] access_token - Constant Contact OAuth2 access token
1019
937
  # @param [String] file_id - Specifies the MyLibrary file to delete
1020
938
  # @return [Boolean]
1021
- def delete_library_file(access_token, file_id)
1022
- Services::LibraryService.delete_library_file(access_token, file_id)
939
+ def delete_library_file(file_id)
940
+ Services::LibraryService.delete_library_file(file_id)
1023
941
  end
1024
942
 
1025
943
 
1026
944
  # Retrieve the upload status for one or more MyLibrary files using the file_id path parameter;
1027
945
  # separate multiple file IDs with a comma
1028
- # @param [String] access_token - Constant Contact OAuth2 access token
1029
946
  # @param [String] file_id - Specifies the files for which to retrieve upload status information
1030
947
  # @return [Array<UploadStatus>]
1031
- def get_library_files_upload_status(access_token, file_id)
1032
- Services::LibraryService.get_library_files_upload_status(access_token, file_id)
948
+ def get_library_files_upload_status(file_id)
949
+ Services::LibraryService.get_library_files_upload_status(file_id)
1033
950
  end
1034
951
 
1035
952
 
1036
953
  # Move one or more MyLibrary files to a different folder in the user's account
1037
- # specify the destination folder using the folder_id path parameter.
1038
- # @param [String] access_token - Constant Contact OAuth2 access token
954
+ # specify the destination folder using the folder_id path parameter.
1039
955
  # @param [String] folder_id - Specifies the destination MyLibrary folder to which the files will be moved
1040
956
  # @param [String] file_id - Specifies the files to move, in a string of comma separated file ids (e.g. 8,9)
1041
957
  # @return [Array<MoveResults>]
1042
- def move_library_files(access_token, folder_id, file_id)
1043
- Services::LibraryService.move_library_files(access_token, folder_id, file_id)
958
+ def move_library_files(folder_id, file_id)
959
+ Services::LibraryService.move_library_files(folder_id, file_id)
1044
960
  end
1045
961
 
1046
962
 
@@ -1054,7 +970,7 @@ module ConstantContact
1054
970
  # @raise IllegalArgumentException - if the item is not an instance of the class name given, or cannot be
1055
971
  # converted to a numeric value
1056
972
  # @return [Integer]
1057
- def get_argument_id(item, class_name)
973
+ def to_id(item, class_name)
1058
974
  item_id = nil
1059
975
  if item.is_a?(Integer)
1060
976
  item_id = item