Class: ConstantContactClient::BulkActivitiesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/constant_contact_client/api/bulk_activities_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BulkActivitiesApi

Returns a new instance of BulkActivitiesApi.



19
20
21
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_csv_import_activity(file, list_ids, opts = {}) ⇒ CreateCSVImportActivity201Response

Import Contacts using a CSV File This multipart method creates an asynchronous background job that adds or updates contacts by importing a CSV file containing contact information. Do not use a Content-Type header value with this method. Importing a new contact email address automatically sets the contact's permission_to_send property as implicit and the opt_in_source property as Account. Importing an existing contact only updates the contact properties you include in the request. Importing contacts with sms_numbers requires using the sms_permission_to_send parameter to specify permissions for all contacts being imported. Set to explicit to specify that all contacts either provided explicit permission. Set to not_set if permission was not provided. If explicit, you must also include the sms_consent_date as a column header to include the date the contact consented to receiving SMS messages. Contacts must have either an email address or an SMS number defined. The CSV file has a maximum of 40,000 lines including the header row (39,999 contacts) and a maximum file size of 4 megabytes (MB). Lines above the 40,000 line maximum are not processed. If the request body exceeds 4 MB, only the contacts contained in the first 4 MB are imported and the remaining data is dropped.

Parameters:

  • file (File)

    The CSV file you are importing must include either `email` or `sms_number` as a column heading. Other properties you can include using column headings are: `first_name`. `last_name`, `phone`, `job_title`, `anniversary`, `birthday_day`, `birthday_month`, `company_name`, `street`, `street2`, `city`, `state`, `zip`, `country`, and `sms_consent_date`. If adding an `sms_number`, you must also include the `sms_permission_to_send` parameter and set it to either `not_set` or `explicit`. If `explicit`, requires including `sms_consent_date` as a column header to specify the date the contact consented to receiving SMS messages. You can also use custom fields as column headings. Enter the custom field name prefixed with `cf:` as the column heading. For example, use `cf:first_name` as the header name if you have a custom field named \"first_name\". The custom field must already exist in the Constant Contact account you are using. Depending on the custom field data type, you can enter dates or strings as the value of the custom field. Each contact can contain up to 25 different custom fields.

  • list_ids (String)

    Specify which contact lists you are adding all imported contacts to as an array of up to 50 contact `list_id` values.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :sms_permission_to_send (String)

    If importing contact `sms_number`s, use this parameter to specify how SMS consent was provided. If all contacts in the file provided their consent, set to `explicit` and include each contact's `sms_consent_date`. If all contacts in the file have not yet provided consent, set to `not_set` (`sms_consent_date` is not required). You cannot message a contact that does not have a sms consent date set.

Returns:



29
30
31
32
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 29

def create_csv_import_activity(file, list_ids, opts = {})
  data, _status_code, _headers = create_csv_import_activity_with_http_info(file, list_ids, opts)
  data
end

#create_csv_import_activity_with_http_info(file, list_ids, opts = {}) ⇒ Array<(CreateCSVImportActivity201Response, Integer, Hash)>

Import Contacts using a CSV File This multipart method creates an asynchronous background job that adds or updates contacts by importing a CSV file containing contact information. Do not use a Content-Type header value with this method. Importing a new contact email address automatically sets the contact's `permission_to_send` property as `implicit` and the `opt_in_source` property as `Account`. Importing an existing contact only updates the contact properties you include in the request. Importing contacts with `sms_number`s requires using the `sms_permission_to_send` parameter to specify permissions for all contacts being imported. Set to `explicit` to specify that all contacts either provided explicit permission. Set to `not_set` if permission was not provided. If `explicit`, you must also include the `sms_consent_date` as a column header to include the date the contact consented to receiving SMS messages. Contacts must have either an email address or an SMS number defined. The CSV file has a maximum of 40,000 lines including the header row (39,999 contacts) and a maximum file size of 4 megabytes (MB). Lines above the 40,000 line maximum are not processed. If the request body exceeds 4 MB, only the contacts contained in the first 4 MB are imported and the remaining data is dropped.

Parameters:

  • file (File)

    The CSV file you are importing must include either `email` or `sms_number` as a column heading. Other properties you can include using column headings are: `first_name`. `last_name`, `phone`, `job_title`, `anniversary`, `birthday_day`, `birthday_month`, `company_name`, `street`, `street2`, `city`, `state`, `zip`, `country`, and `sms_consent_date`. If adding an `sms_number`, you must also include the `sms_permission_to_send` parameter and set it to either `not_set` or `explicit`. If `explicit`, requires including `sms_consent_date` as a column header to specify the date the contact consented to receiving SMS messages. You can also use custom fields as column headings. Enter the custom field name prefixed with `cf:` as the column heading. For example, use `cf:first_name` as the header name if you have a custom field named \&quot;first_name\&quot;. The custom field must already exist in the Constant Contact account you are using. Depending on the custom field data type, you can enter dates or strings as the value of the custom field. Each contact can contain up to 25 different custom fields.

  • list_ids (String)

    Specify which contact lists you are adding all imported contacts to as an array of up to 50 contact `list_id` values.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :sms_permission_to_send (String)

    If importing contact `sms_number`s, use this parameter to specify how SMS consent was provided. If all contacts in the file provided their consent, set to `explicit` and include each contact's `sms_consent_date`. If all contacts in the file have not yet provided consent, set to `not_set` (`sms_consent_date` is not required). You cannot message a contact that does not have a sms consent date set.

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 41

def create_csv_import_activity_with_http_info(file, list_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_csv_import_activity ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling BulkActivitiesApi.create_csv_import_activity"
  end
  # verify the required parameter 'list_ids' is set
  if @api_client.config.client_side_validation && list_ids.nil?
    fail ArgumentError, "Missing the required parameter 'list_ids' when calling BulkActivitiesApi.create_csv_import_activity"
  end
  allowable_values = ["not_set", "explicit"]
  if @api_client.config.client_side_validation && opts[:'sms_permission_to_send'] && !allowable_values.include?(opts[:'sms_permission_to_send'])
    fail ArgumentError, "invalid value for \"sms_permission_to_send\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/activities/contacts_file_import'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['list_ids'] = list_ids
  form_params['sms_permission_to_send'] = opts[:'sms_permission_to_send'] if !opts[:'sms_permission_to_send'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CreateCSVImportActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_csv_import_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_csv_import_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_delete_activity(create_delete_activity_request, opts = {}) ⇒ CreateDeleteActivity201Response

Delete Contacts in Bulk Use this endpoint to bulk delete contacts in an account. Contacts to delete are specified by contact_id (up to 500), or by list_id (up to 50 lists); all contacts that are members of the list_ids are deleted. Deleted contacts won’t receive email from you, and they don’t count as active contacts. Unlike unsubscribed contacts, deleted contacts can be added back to an account. Learn how to revive deleted contacts.

Parameters:

  • create_delete_activity_request (CreateDeleteActivityRequest)

    The request body contains an array of contact_ids <em>or</em> list_ids. All contact_ids provided are deleted, or all members of each specified list_id are deleted.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



110
111
112
113
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 110

def create_delete_activity(create_delete_activity_request, opts = {})
  data, _status_code, _headers = create_delete_activity_with_http_info(create_delete_activity_request, opts)
  data
end

#create_delete_activity_with_http_info(create_delete_activity_request, opts = {}) ⇒ Array<(CreateDeleteActivity201Response, Integer, Hash)>

Delete Contacts in Bulk Use this endpoint to bulk delete contacts in an account. Contacts to delete are specified by contact_id (up to 500), or by list_id (up to 50 lists); all contacts that are members of the list_ids are deleted. Deleted contacts won’t receive email from you, and they don’t count as active contacts. Unlike unsubscribed contacts, deleted contacts can be added back to an account. Learn how to revive deleted contacts.

Parameters:

  • create_delete_activity_request (CreateDeleteActivityRequest)

    The request body contains an array of contact_ids <em>or</em> list_ids. All contact_ids provided are deleted, or all members of each specified list_id are deleted.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 120

def create_delete_activity_with_http_info(create_delete_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_delete_activity ...'
  end
  # verify the required parameter 'create_delete_activity_request' is set
  if @api_client.config.client_side_validation && create_delete_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_delete_activity_request' when calling BulkActivitiesApi.create_delete_activity"
  end
  # resource path
  local_var_path = '/activities/contact_delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_delete_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateDeleteActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_delete_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_delete_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_export_activity(create_export_activity_request, opts = {}) ⇒ CreateExportActivity201Response

Export Contacts to a File Use this method to create an activity that exports contacts and contact details to a CSV file. You can choose to export all contacts in your account (default) or you can use parameters to filter on which contacts to export. After Constant Contact finishes processing the activity, use the results link in the response body to retrieve the CSV file.

Parameters:

  • create_export_activity_request (CreateExportActivityRequest)

    A JSON payload that specifies the contacts (rows in the CSV file) and contact properties (columns in the CSV file) you want to export.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



178
179
180
181
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 178

def create_export_activity(create_export_activity_request, opts = {})
  data, _status_code, _headers = create_export_activity_with_http_info(create_export_activity_request, opts)
  data
end

#create_export_activity_with_http_info(create_export_activity_request, opts = {}) ⇒ Array<(CreateExportActivity201Response, Integer, Hash)>

Export Contacts to a File Use this method to create an activity that exports contacts and contact details to a CSV file. You can choose to export all contacts in your account (default) or you can use parameters to filter on which contacts to export. After Constant Contact finishes processing the activity, use the `results` link in the response body to retrieve the CSV file.

Parameters:

  • create_export_activity_request (CreateExportActivityRequest)

    A JSON payload that specifies the contacts (rows in the CSV file) and contact properties (columns in the CSV file) you want to export.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 188

def create_export_activity_with_http_info(create_export_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_export_activity ...'
  end
  # verify the required parameter 'create_export_activity_request' is set
  if @api_client.config.client_side_validation && create_export_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_export_activity_request' when calling BulkActivitiesApi.create_export_activity"
  end
  # resource path
  local_var_path = '/activities/contact_exports'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_export_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateExportActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_export_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_export_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_import_json_activity(create_import_json_activity_request, opts = {}) ⇒ CreateCSVImportActivity201Response

Import Contacts using a JSON Payload Use this method to create an asynchronous background job that adds new contacts or updates existing contacts by importing a JSON payload. This method requires a request body that contains the contact data you are importing and the contact lists to which you want to add the imported contacts. A contact's data must include an email address and/or sms_number. The sms_number must be a US phone number to associate with the contact's SMS-enabled phone. Valid formats are 1231231234 or 123-123-1234 (the country code must be valid). Importing a new contact using this method automatically sets the contact's email permission_to_send property to implicit and the opt_in_source property as Account. Importing an existing contact only updates the contact properties you include in the request. For each contact, you can import up to three addresses and three phone numbers. International phone numbers are currently not supported. To import custom fields, prefix the custom field name with cf: and add it as a contact property. For example, use the property name cf:first_name if you have a custom field named first_name. The custom field must already exist in the Constant Contact account you are using. Each contact can contain up to 25 custom fields. To include a contact's sms_number, if the contact provided explicit permission to receive SMS messages, you must set the sms_permission_to_send property to explicit and specify the date of consent using the sms_consent_date column header. If explicit permission was not provided, set sms_permission_to_send to not_set (the sms_consent_date is not required). If the sms_consent_date is not set, SMS messages cannot be sent to contacts and sms_permission_to_send defaults to not_set. Valid value formats for sms_consent_date include MM/DD/YYYY, M/D/YYYY, YYYY/MM/DD, YYYY/M/D, YYYY-MM-DD, YYYY-M-D,M-D-YYYY, or M-DD-YYYY. The request body payload has a maximum size of 4 megabytes (MB). If the request body exceeds 4 MB, this method only imports the first 4 MB and drops the remaining data. Use the activity URL to check the status of the import activity request.

Parameters:

  • create_import_json_activity_request (CreateImportJSONActivityRequest)

    The JSON request payload that contains the contact data and contact lists for the import.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



246
247
248
249
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 246

def create_import_json_activity(create_import_json_activity_request, opts = {})
  data, _status_code, _headers = create_import_json_activity_with_http_info(create_import_json_activity_request, opts)
  data
end

#create_import_json_activity_with_http_info(create_import_json_activity_request, opts = {}) ⇒ Array<(CreateCSVImportActivity201Response, Integer, Hash)>

Import Contacts using a JSON Payload Use this method to create an asynchronous background job that adds new contacts or updates existing contacts by importing a JSON payload. This method requires a request body that contains the contact data you are importing and the contact lists to which you want to add the imported contacts. A contact's data must include an `email` address and/or `sms_number`. The `sms_number` must be a US phone number to associate with the contact's SMS-enabled phone. Valid formats are <code>1231231234</code> or <code>123-123-1234</code> (the country code must be valid). Importing a new contact using this method automatically sets the contact's email `permission_to_send` property to `implicit` and the `opt_in_source` property as `Account`. Importing an existing contact only updates the contact properties you include in the request. For each contact, you can import up to three addresses and three phone numbers. International phone numbers are currently not supported. To import custom fields, prefix the custom field name with `cf:` and add it as a contact property. For example, use the property name `cf:first_name` if you have a custom field named `first_name`. The custom field must already exist in the Constant Contact account you are using. Each contact can contain up to 25 custom fields. To include a contact's `sms_number`, if the contact provided explicit permission to receive SMS messages, you must set the `sms_permission_to_send` property to `explicit` and specify the date of consent using the `sms_consent_date` column header. If explicit permission was not provided, set `sms_permission_to_send` to `not_set` (the `sms_consent_date` is not required). If the `sms_consent_date` is not set, SMS messages cannot be sent to contacts and `sms_permission_to_send` defaults to `not_set`. Valid value formats for `sms_consent_date` include MM/DD/YYYY, M/D/YYYY, YYYY/MM/DD, YYYY/M/D, YYYY-MM-DD, YYYY-M-D,M-D-YYYY, or M-DD-YYYY. The request body payload has a maximum size of 4 megabytes (MB). If the request body exceeds 4 MB, this method only imports the first 4 MB and drops the remaining data. Use the activity URL to check the status of the import activity request.

Parameters:

  • create_import_json_activity_request (CreateImportJSONActivityRequest)

    The JSON request payload that contains the contact data and contact lists for the import.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 256

def create_import_json_activity_with_http_info(create_import_json_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_import_json_activity ...'
  end
  # verify the required parameter 'create_import_json_activity_request' is set
  if @api_client.config.client_side_validation && create_import_json_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_import_json_activity_request' when calling BulkActivitiesApi.create_import_json_activity"
  end
  # resource path
  local_var_path = '/activities/contacts_json_import'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_import_json_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateCSVImportActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_import_json_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_import_json_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_list_add_activity(create_list_add_activity_request, opts = {}) ⇒ CreateListRemoveActivity201Response

Add Contacts to Lists Use this method to create an activity that adds contacts to one or more lists. Each contact can be a member of up to 50 lists. Use the properties in the source object to specify the contacts you want to add to lists. Use the list_ids array to specify which lists you want to add your source contacts to.

Parameters:

  • create_list_add_activity_request (CreateListAddActivityRequest)

    The JSON payload used to create the 'add contacts to lists' activity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



314
315
316
317
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 314

def create_list_add_activity(create_list_add_activity_request, opts = {})
  data, _status_code, _headers = create_list_add_activity_with_http_info(create_list_add_activity_request, opts)
  data
end

#create_list_add_activity_with_http_info(create_list_add_activity_request, opts = {}) ⇒ Array<(CreateListRemoveActivity201Response, Integer, Hash)>

Add Contacts to Lists Use this method to create an activity that adds contacts to one or more lists. Each contact can be a member of up to 50 lists. Use the properties in the `source` object to specify the contacts you want to add to lists. Use the `list_ids` array to specify which lists you want to add your source contacts to.

Parameters:

  • create_list_add_activity_request (CreateListAddActivityRequest)

    The JSON payload used to create the 'add contacts to lists' activity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 324

def create_list_add_activity_with_http_info(create_list_add_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_list_add_activity ...'
  end
  # verify the required parameter 'create_list_add_activity_request' is set
  if @api_client.config.client_side_validation && create_list_add_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_list_add_activity_request' when calling BulkActivitiesApi.create_list_add_activity"
  end
  # resource path
  local_var_path = '/activities/add_list_memberships'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_list_add_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateListRemoveActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_list_add_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_list_add_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_list_delete_activity(create_list_delete_activity_request, opts = {}) ⇒ CreateListDeleteActivity201Response

Delete Contact Lists Use this endpoint to delete up to 100 contact lists in an account.

Parameters:

  • create_list_delete_activity_request (CreateListDeleteActivityRequest)

    An array of `list_id`'s to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



382
383
384
385
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 382

def create_list_delete_activity(create_list_delete_activity_request, opts = {})
  data, _status_code, _headers = create_list_delete_activity_with_http_info(create_list_delete_activity_request, opts)
  data
end

#create_list_delete_activity_with_http_info(create_list_delete_activity_request, opts = {}) ⇒ Array<(CreateListDeleteActivity201Response, Integer, Hash)>

Delete Contact Lists Use this endpoint to delete up to 100 contact lists in an account.

Parameters:

  • create_list_delete_activity_request (CreateListDeleteActivityRequest)

    An array of `list_id`'s to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 392

def create_list_delete_activity_with_http_info(create_list_delete_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_list_delete_activity ...'
  end
  # verify the required parameter 'create_list_delete_activity_request' is set
  if @api_client.config.client_side_validation && create_list_delete_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_list_delete_activity_request' when calling BulkActivitiesApi.create_list_delete_activity"
  end
  # resource path
  local_var_path = '/activities/list_delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_list_delete_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateListDeleteActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_list_delete_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_list_delete_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_list_remove_activity(create_list_remove_activity_request, opts = {}) ⇒ CreateListRemoveActivity201Response

Remove Contacts from Lists Use this method to create an activity that removes contacts from one or more contact lists. Use the properties in the source object to remove specific contacts from your lists. Use the list_ids array to specify the target lists from which contacts are removed. Optionally, if the source is all_active_contacts (billable) or list_ids, use the exclude object to exclude specific contacts from being removed from the destination lists.

Parameters:

  • create_list_remove_activity_request (CreateListRemoveActivityRequest)

    The JSON payload used to create the Remove Contacts from Lists' activity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



450
451
452
453
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 450

def create_list_remove_activity(create_list_remove_activity_request, opts = {})
  data, _status_code, _headers = create_list_remove_activity_with_http_info(create_list_remove_activity_request, opts)
  data
end

#create_list_remove_activity_with_http_info(create_list_remove_activity_request, opts = {}) ⇒ Array<(CreateListRemoveActivity201Response, Integer, Hash)>

Remove Contacts from Lists Use this method to create an activity that removes contacts from one or more contact lists. Use the properties in the `source` object to remove specific contacts from your lists. Use the `list_ids` array to specify the target lists from which contacts are removed. Optionally, if the source is `all_active_contacts` (billable) or `list_ids`, use the `exclude` object to exclude specific contacts from being removed from the destination lists.

Parameters:

  • create_list_remove_activity_request (CreateListRemoveActivityRequest)

    The JSON payload used to create the Remove Contacts from Lists' activity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 460

def create_list_remove_activity_with_http_info(create_list_remove_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_list_remove_activity ...'
  end
  # verify the required parameter 'create_list_remove_activity_request' is set
  if @api_client.config.client_side_validation && create_list_remove_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_list_remove_activity_request' when calling BulkActivitiesApi.create_list_remove_activity"
  end
  # resource path
  local_var_path = '/activities/remove_list_memberships'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_list_remove_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateListRemoveActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_list_remove_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_list_remove_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tag_add_contact_activity(create_tag_remove_activity_request, opts = {}) ⇒ CreateTagRemoveActivity201Response

Add Tags to Contacts Use this method to create an asynchronous activity that adds one or more tags to all contacts meeting your contact filtering criteria. Use the source type to identify contacts from which the specified tags (tag_id) are added. Source criteria are mutually exclusive. If the source is all_active_contacts or list_ids, you can optionally choose to exclude contacts by contact_id. Use the activity link in the results to check the status of your request. For more use case information, see "Add Tags to Contacts

Parameters:

  • create_tag_remove_activity_request (CreateTagRemoveActivityRequest)

    The JSON payload used to create an asynchronous activity that adds tags to contacts that meet your specified contact filtering criteria.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



518
519
520
521
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 518

def create_tag_add_contact_activity(create_tag_remove_activity_request, opts = {})
  data, _status_code, _headers = create_tag_add_contact_activity_with_http_info(create_tag_remove_activity_request, opts)
  data
end

#create_tag_add_contact_activity_with_http_info(create_tag_remove_activity_request, opts = {}) ⇒ Array<(CreateTagRemoveActivity201Response, Integer, Hash)>

Add Tags to Contacts Use this method to create an asynchronous activity that adds one or more tags to all contacts meeting your contact filtering criteria. Use the `source` type to identify contacts from which the specified tags (`tag_id`) are added. Source criteria are mutually exclusive. If the source is `all_active_contacts` or `list_ids`, you can optionally choose to `exclude` contacts by `contact_id`. Use the activity link in the results to check the status of your request. For more use case information, see &quot;Add Tags to Contacts

Parameters:

  • create_tag_remove_activity_request (CreateTagRemoveActivityRequest)

    The JSON payload used to create an asynchronous activity that adds tags to contacts that meet your specified contact filtering criteria.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 528

def create_tag_add_contact_activity_with_http_info(create_tag_remove_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_tag_add_contact_activity ...'
  end
  # verify the required parameter 'create_tag_remove_activity_request' is set
  if @api_client.config.client_side_validation && create_tag_remove_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_tag_remove_activity_request' when calling BulkActivitiesApi.create_tag_add_contact_activity"
  end
  # resource path
  local_var_path = '/activities/contacts_taggings_add'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_tag_remove_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateTagRemoveActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_tag_add_contact_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_tag_add_contact_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tag_delete_activity(create_tag_delete_activity_request, opts = {}) ⇒ CreateTagRemoveActivity201Response

Delete Tags Use this method to create an asynchronous activity that deletes up to 500 tags. Deleted tags are automatically removed from tagged contacts. Use the tag_ids array of string values in the request body to specify which tags to delete.

Parameters:

  • create_tag_delete_activity_request (CreateTagDeleteActivityRequest)

    An array of string values (`tag_id`s) to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



586
587
588
589
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 586

def create_tag_delete_activity(create_tag_delete_activity_request, opts = {})
  data, _status_code, _headers = create_tag_delete_activity_with_http_info(create_tag_delete_activity_request, opts)
  data
end

#create_tag_delete_activity_with_http_info(create_tag_delete_activity_request, opts = {}) ⇒ Array<(CreateTagRemoveActivity201Response, Integer, Hash)>

Delete Tags Use this method to create an asynchronous activity that deletes up to 500 tags. Deleted tags are automatically removed from tagged contacts. Use the `tag_ids` array of string values in the request body to specify which tags to delete.

Parameters:

  • create_tag_delete_activity_request (CreateTagDeleteActivityRequest)

    An array of string values (`tag_id`s) to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 596

def create_tag_delete_activity_with_http_info(create_tag_delete_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_tag_delete_activity ...'
  end
  # verify the required parameter 'create_tag_delete_activity_request' is set
  if @api_client.config.client_side_validation && create_tag_delete_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_tag_delete_activity_request' when calling BulkActivitiesApi.create_tag_delete_activity"
  end
  # resource path
  local_var_path = '/activities/contacts_tags_delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_tag_delete_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateTagRemoveActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_tag_delete_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_tag_delete_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tag_remove_activity(create_tag_remove_activity_request, opts = {}) ⇒ CreateTagRemoveActivity201Response

Remove Tags from Contacts Use this method to create an asynchronous activity that removes one or more tags from all contacts meeting your contact filtering criteria. Filtering criteria must include the source type used to identify contacts from which the specified tags (tag_id) are removed. Source types are mutually exclusive. If the specified source is either all_active_contacts or list_ids, you can optionally choose to exclude specified contacts by contact_id. Use the activity link in the results to check the status of your request." For more use case information, see "Remove Tags from Contacts

Parameters:

  • create_tag_remove_activity_request (CreateTagRemoveActivityRequest)

    The JSON payload used to create an asynchronous activity that removes tags from contacts meeting your specified contact filtering criteria.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



654
655
656
657
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 654

def create_tag_remove_activity(create_tag_remove_activity_request, opts = {})
  data, _status_code, _headers = create_tag_remove_activity_with_http_info(create_tag_remove_activity_request, opts)
  data
end

#create_tag_remove_activity_with_http_info(create_tag_remove_activity_request, opts = {}) ⇒ Array<(CreateTagRemoveActivity201Response, Integer, Hash)>

Remove Tags from Contacts Use this method to create an asynchronous activity that removes one or more tags from all contacts meeting your contact filtering criteria. Filtering criteria must include the `source` type used to identify contacts from which the specified tags (`tag_id`) are removed. Source types are mutually exclusive. If the specified source is either `all_active_contacts` or `list_ids`, you can optionally choose to `exclude` specified contacts by `contact_id`. Use the activity link in the results to check the status of your request.&quot; For more use case information, see &quot;Remove Tags from Contacts

Parameters:

  • create_tag_remove_activity_request (CreateTagRemoveActivityRequest)

    The JSON payload used to create an asynchronous activity that removes tags from contacts meeting your specified contact filtering criteria.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 664

def create_tag_remove_activity_with_http_info(create_tag_remove_activity_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.create_tag_remove_activity ...'
  end
  # verify the required parameter 'create_tag_remove_activity_request' is set
  if @api_client.config.client_side_validation && create_tag_remove_activity_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_tag_remove_activity_request' when calling BulkActivitiesApi.create_tag_remove_activity"
  end
  # resource path
  local_var_path = '/activities/contacts_taggings_remove'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_tag_remove_activity_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateTagRemoveActivity201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.create_tag_remove_activity",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#create_tag_remove_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_activity_by_id(activity_id, opts = {}) ⇒ GetActivityById200Response

GET an Activity Status This endpoint returns an activity status report.

Parameters:

  • activity_id (String)

    The unique ID of the activity to GET

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



722
723
724
725
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 722

def get_activity_by_id(activity_id, opts = {})
  data, _status_code, _headers = get_activity_by_id_with_http_info(activity_id, opts)
  data
end

#get_activity_by_id_with_http_info(activity_id, opts = {}) ⇒ Array<(GetActivityById200Response, Integer, Hash)>

GET an Activity Status This endpoint returns an activity status report.

Parameters:

  • activity_id (String)

    The unique ID of the activity to GET

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetActivityById200Response, Integer, Hash)>)

    GetActivityById200Response data, response status code and response headers



732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 732

def get_activity_by_id_with_http_info(activity_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.get_activity_by_id ...'
  end
  # verify the required parameter 'activity_id' is set
  if @api_client.config.client_side_validation && activity_id.nil?
    fail ArgumentError, "Missing the required parameter 'activity_id' when calling BulkActivitiesApi.get_activity_by_id"
  end
  # resource path
  local_var_path = '/activities/{activity_id}'.sub('{' + 'activity_id' + '}', CGI.escape(activity_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetActivityById200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.get_activity_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#get_activity_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_activities(opts = {}) ⇒ GetAllActivities200Response

GET Activity Status Collection This endpoint returns a collection of activities. Use the state query parameter to include only activities with a specific status (processing, completed, cancelled, failed, or time_out). Use the limit query parameter to define the number of activities returned per page. Learn more.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Specifies the number of results displayed per page of output, from 1 - 500, default = 50. (default to 50)

  • :state (String)

    Use this parameter to filter the response to include only activities in one of the following states: cancelled, completed, failed, processing, or timed_out.

Returns:



786
787
788
789
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 786

def get_all_activities(opts = {})
  data, _status_code, _headers = get_all_activities_with_http_info(opts)
  data
end

#get_all_activities_with_http_info(opts = {}) ⇒ Array<(GetAllActivities200Response, Integer, Hash)>

GET Activity Status Collection This endpoint returns a collection of activities. Use the state query parameter to include only activities with a specific status (processing, completed, cancelled, failed, or time_out). Use the limit query parameter to define the number of activities returned per page. Learn more.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Specifies the number of results displayed per page of output, from 1 - 500, default = 50. (default to 50)

  • :state (String)

    Use this parameter to filter the response to include only activities in one of the following states: cancelled, completed, failed, processing, or timed_out.

Returns:

  • (Array<(GetAllActivities200Response, Integer, Hash)>)

    GetAllActivities200Response data, response status code and response headers



797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 797

def get_all_activities_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.get_all_activities ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BulkActivitiesApi.get_all_activities, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BulkActivitiesApi.get_all_activities, must be greater than or equal to 1.'
  end

  allowable_values = ["processing", "completed", "cancelled", "failed", "timed_out"]
  if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
    fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/activities'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAllActivities200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.get_all_activities",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#get_all_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_csv_export_file(file_export_id, opts = {}) ⇒ String

Retrieve Exported Contacts File Use this endpoint to retrieve (GET) a CSV file containing exported contacts by providing the activity_id of a completed CSV export activity.

Parameters:

  • file_export_id (String)

    The unique ID of the exported file provided in the results: section of the export contacts activity response.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


860
861
862
863
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 860

def get_csv_export_file(file_export_id, opts = {})
  data, _status_code, _headers = get_csv_export_file_with_http_info(file_export_id, opts)
  data
end

#get_csv_export_file_with_http_info(file_export_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Retrieve Exported Contacts File Use this endpoint to retrieve (GET) a CSV file containing exported contacts by providing the `activity_id` of a completed CSV export activity.

Parameters:

  • file_export_id (String)

    The unique ID of the exported file provided in the results: section of the export contacts activity response.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 870

def get_csv_export_file_with_http_info(file_export_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.get_csv_export_file ...'
  end
  # verify the required parameter 'file_export_id' is set
  if @api_client.config.client_side_validation && file_export_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_export_id' when calling BulkActivitiesApi.get_csv_export_file"
  end
  # resource path
  local_var_path = '/contact_exports/{file_export_id}'.sub('{' + 'file_export_id' + '}', CGI.escape(file_export_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/csv'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.get_csv_export_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#get_csv_export_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_custom_field_delete(post_custom_field_delete_request, opts = {}) ⇒ PostCustomFieldDelete201Response

Delete Custom Fields Use this endpoint to delete up to 100 custom fields for an account.

Parameters:

  • post_custom_field_delete_request (PostCustomFieldDeleteRequest)

    An array of `custom_field_id`'s to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



923
924
925
926
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 923

def post_custom_field_delete(post_custom_field_delete_request, opts = {})
  data, _status_code, _headers = post_custom_field_delete_with_http_info(post_custom_field_delete_request, opts)
  data
end

#post_custom_field_delete_with_http_info(post_custom_field_delete_request, opts = {}) ⇒ Array<(PostCustomFieldDelete201Response, Integer, Hash)>

Delete Custom Fields Use this endpoint to delete up to 100 custom fields for an account.

Parameters:

  • post_custom_field_delete_request (PostCustomFieldDeleteRequest)

    An array of `custom_field_id`'s to delete.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 933

def post_custom_field_delete_with_http_info(post_custom_field_delete_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BulkActivitiesApi.post_custom_field_delete ...'
  end
  # verify the required parameter 'post_custom_field_delete_request' is set
  if @api_client.config.client_side_validation && post_custom_field_delete_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_custom_field_delete_request' when calling BulkActivitiesApi.post_custom_field_delete"
  end
  # resource path
  local_var_path = '/activities/custom_fields_delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(post_custom_field_delete_request)

  # return_type
  return_type = opts[:debug_return_type] || 'PostCustomFieldDelete201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"BulkActivitiesApi.post_custom_field_delete",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BulkActivitiesApi#post_custom_field_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end