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 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. 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. The column headings that you can use in the file are: `first_name`, `last_name`, `email`, `phone`, `job_title`, `anniversary`, `birthday_day`, `birthday_month`, `company_name`, `street`, `street2`, `city`, `state`, `zip`, and `country`. The only required column heading is `email`. 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 (Array<String>)

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

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

    the optional parameters

Returns:



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

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 automatically sets the contact&#39;s &#x60;permission_to_send&#x60; property as &#x60;implicit&#x60; and the &#x60;opt_in_source&#x60; property as &#x60;Account&#x60;. Importing an existing contact only updates the contact properties you include in the request. 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. The column headings that you can use in the file are: &#x60;first_name&#x60;, &#x60;last_name&#x60;, &#x60;email&#x60;, &#x60;phone&#x60;, &#x60;job_title&#x60;, &#x60;anniversary&#x60;, &#x60;birthday_day&#x60;, &#x60;birthday_month&#x60;, &#x60;company_name&#x60;, &#x60;street&#x60;, &#x60;street2&#x60;, &#x60;city&#x60;, &#x60;state&#x60;, &#x60;zip&#x60;, and &#x60;country&#x60;. The only required column heading is &#x60;email&#x60;. You can also use custom fields as column headings. Enter the custom field name prefixed with &#x60;cf:&#x60; as the column heading. For example, use &#x60;cf:first_name&#x60; 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 (Array<String>)

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

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

    the optional parameters

Returns:



39
40
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 39

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
  if @api_client.config.client_side_validation && list_ids.length > 50
    fail ArgumentError, 'invalid value for "list_ids" when calling BulkActivitiesApi.create_csv_import_activity, number of items must be less than or equal to 50.'
  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'] = @api_client.build_collection_param(list_ids, :csv)

  # 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](/api_guide/contacts_delete.html#revive).

Parameters:

  • create_delete_activity_request (CreateDeleteActivityRequest)

    The request body contains an array of contact_ids &lt;em&gt;or&lt;/em&gt; 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:



107
108
109
110
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 107

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](/api_guide/contacts_delete.html#revive).

Parameters:

  • create_delete_activity_request (CreateDeleteActivityRequest)

    The request body contains an array of contact_ids &lt;em&gt;or&lt;/em&gt; 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:



117
118
119
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 117

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. By default, all contacts are exported. To filter contacts to export, specify the source to use, ‘contact_id`, `list_id`, or `segment_id` (all mutually exclusive). By default, all contact related fields are exported. Use the fields array to only export specific contact fields. You must export `email_address` to successfully export `email_optin_source`, `email_optin_date`, `email_optout_source`, `email_optout_date`, or `email_optout_reason`. 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:



175
176
177
178
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 175

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. By default, all contacts are exported. To filter contacts to export, specify the source to use, &#x60;contact_id&#x60;, &#x60;list_id&#x60;, or &#x60;segment_id&#x60; (all mutually exclusive). By default, all contact related fields are exported. Use the fields array to only export specific contact fields. You must export &#x60;email_address&#x60; to successfully export &#x60;email_optin_source&#x60;, &#x60;email_optin_date&#x60;, &#x60;email_optout_source&#x60;, &#x60;email_optout_date&#x60;, or &#x60;email_optout_reason&#x60;. After Constant Contact finishes processing the activity, use the &#x60;results&#x60; 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:



185
186
187
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 185

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. Importing a new contact 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. 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. 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:



243
244
245
246
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 243

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. Importing a new contact automatically sets the contact&#39;s &#x60;permission_to_send&#x60; property as &#x60;implicit&#x60; and the &#x60;opt_in_source&#x60; property as &#x60;Account&#x60;. 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 &#x60;cf:&#x60; and add it as a contact property. For example, use the property name &#x60;cf:first_name&#x60; 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. 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:



253
254
255
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 253

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 &#39;add contacts to lists&#39; activity

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

    the optional parameters

Returns:



311
312
313
314
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 311

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 &#x60;source&#x60; object to specify the contacts you want to add to lists. Use the &#x60;list_ids&#x60; 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 &#39;add contacts to lists&#39; activity

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

    the optional parameters

Returns:



321
322
323
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 321

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 &#x60;list_id&#x60;&#39;s to delete.

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

    the optional parameters

Returns:



379
380
381
382
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 379

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 &#x60;list_id&#x60;&#39;s to delete.

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

    the optional parameters

Returns:



389
390
391
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 389

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&#39; activity

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

    the optional parameters

Returns:



447
448
449
450
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 447

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 &#x60;source&#x60; object to remove specific contacts from your lists. Use the &#x60;list_ids&#x60; array to specify the target lists from which contacts are removed. Optionally, if the source is &#x60;all_active_contacts&#x60; (billable) or &#x60;list_ids&#x60;, use the &#x60;exclude&#x60; 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&#39; activity

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

    the optional parameters

Returns:



457
458
459
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 457

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](/api_guide/add_tagging_activity.html)

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:



515
516
517
518
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 515

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 &#x60;source&#x60; type to identify contacts from which the specified tags (&#x60;tag_id&#x60;) are added. Source criteria are mutually exclusive. If the source is &#x60;all_active_contacts&#x60; or &#x60;list_ids&#x60;, you can optionally choose to &#x60;exclude&#x60; contacts by &#x60;contact_id&#x60;. 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](/api_guide/add_tagging_activity.html)

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:



525
526
527
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 525

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 (&#x60;tag_id&#x60;s) to delete.

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

    the optional parameters

Returns:



583
584
585
586
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 583

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 &#x60;tag_ids&#x60; 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 (&#x60;tag_id&#x60;s) to delete.

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

    the optional parameters

Returns:



593
594
595
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 593

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](/api_guide/remove_tagging_activity.html)

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:



651
652
653
654
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 651

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 &#x60;source&#x60; type used to identify contacts from which the specified tags (&#x60;tag_id&#x60;) are removed. Source types are mutually exclusive. If the specified source is either &#x60;all_active_contacts&#x60; or &#x60;list_ids&#x60;, you can optionally choose to &#x60;exclude&#x60; specified contacts by &#x60;contact_id&#x60;. 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](/api_guide/remove_tagging_activity.html)

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:



661
662
663
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 661

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:



719
720
721
722
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 719

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



729
730
731
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 729

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](/api_guide/activity_status.html).

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 &#x3D; 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:



783
784
785
786
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 783

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](/api_guide/activity_status.html).

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 &#x3D; 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



794
795
796
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 794

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)


857
858
859
860
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 857

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 &#x60;activity_id&#x60; 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



867
868
869
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 867

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 &#x60;custom_field_id&#x60;&#39;s to delete.

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

    the optional parameters

Returns:



920
921
922
923
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 920

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 &#x60;custom_field_id&#x60;&#39;s to delete.

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

    the optional parameters

Returns:



930
931
932
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
# File 'lib/constant_contact_client/api/bulk_activities_api.rb', line 930

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