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