Class: ConstantContactClient::ContactListsApi
- Inherits:
-
Object
- Object
- ConstantContactClient::ContactListsApi
- Defined in:
- lib/constant_contact_client/api/contact_lists_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_list(update_list_request, opts = {}) ⇒ UpdateList200Response
POST (create) a List Create a new contact list resource.
-
#create_list_with_http_info(update_list_request, opts = {}) ⇒ Array<(UpdateList200Response, Integer, Hash)>
POST (create) a List Create a new contact list resource.
-
#delete_list(list_id, opts = {}) ⇒ DeleteList202Response
DELETE a List Deletes the specified contact list and its membership.
-
#delete_list_with_http_info(list_id, opts = {}) ⇒ Array<(DeleteList202Response, Integer, Hash)>
DELETE a List Deletes the specified contact list and its membership.
-
#get_all_lists(opts = {}) ⇒ GetAllLists200Response
GET Lists Collection Use this method to return details about all contact lists for the account.
-
#get_all_lists_with_http_info(opts = {}) ⇒ Array<(GetAllLists200Response, Integer, Hash)>
GET Lists Collection Use this method to return details about all contact lists for the account.
-
#get_list(list_id, opts = {}) ⇒ GetList200Response
GET a List Use this method to get details about a specific contact list (‘list_id`).
-
#get_list_id_xrefs(sequence_ids, opts = {}) ⇒ GetListIdXrefs200Response
GET a collection of V2 and V3 API List IDs <div class="Msg Msg–warning"><p class="note-text">Use this endpoint to migrate your locally stored V2 contact list data to the new V3 format.
-
#get_list_id_xrefs_with_http_info(sequence_ids, opts = {}) ⇒ Array<(GetListIdXrefs200Response, Integer, Hash)>
GET a collection of V2 and V3 API List IDs <div class="Msg Msg–warning"><p class="note-text">Use this endpoint to migrate your locally stored V2 contact list data to the new V3 format.
-
#get_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetList200Response, Integer, Hash)>
GET a List Use this method to get details about a specific contact list (`list_id`).
-
#initialize(api_client = ApiClient.default) ⇒ ContactListsApi
constructor
A new instance of ContactListsApi.
-
#update_list(list_id, update_list_request, opts = {}) ⇒ UpdateList200Response
PUT (update) a List Updates an existing contact list resource, specified by ‘list_id`.
-
#update_list_with_http_info(list_id, update_list_request, opts = {}) ⇒ Array<(UpdateList200Response, Integer, Hash)>
PUT (update) a List Updates an existing contact list resource, specified by `list_id`.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ContactListsApi
Returns a new instance of ContactListsApi.
19 20 21 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_list(update_list_request, opts = {}) ⇒ UpdateList200Response
POST (create) a List Create a new contact list resource
27 28 29 30 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 27 def create_list(update_list_request, opts = {}) data, _status_code, _headers = create_list_with_http_info(update_list_request, opts) data end |
#create_list_with_http_info(update_list_request, opts = {}) ⇒ Array<(UpdateList200Response, Integer, Hash)>
POST (create) a List Create a new contact list resource
37 38 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 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 37 def create_list_with_http_info(update_list_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.create_list ...' end # verify the required parameter 'update_list_request' is set if @api_client.config.client_side_validation && update_list_request.nil? fail ArgumentError, "Missing the required parameter 'update_list_request' when calling ContactListsApi.create_list" end # resource path local_var_path = '/contact_lists' # 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(update_list_request) # return_type return_type = opts[:debug_return_type] || 'UpdateList200Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.create_list", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_list(list_id, opts = {}) ⇒ DeleteList202Response
DELETE a List Deletes the specified contact list and its membership. DELETE List requests are processed asynchronously, and you can track the status of the request by making a GET call to the URI shown in the ‘_links` property in the response.
95 96 97 98 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 95 def delete_list(list_id, opts = {}) data, _status_code, _headers = delete_list_with_http_info(list_id, opts) data end |
#delete_list_with_http_info(list_id, opts = {}) ⇒ Array<(DeleteList202Response, Integer, Hash)>
DELETE a List Deletes the specified contact list and its membership. DELETE List requests are processed asynchronously, and you can track the status of the request by making a GET call to the URI shown in the `_links` property in the response.
105 106 107 108 109 110 111 112 113 114 115 116 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 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 105 def delete_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.delete_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactListsApi.delete_list" end # resource path local_var_path = '/contact_lists/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_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] || 'DeleteList202Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.delete_list", :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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_all_lists(opts = {}) ⇒ GetAllLists200Response
GET Lists Collection Use this method to return details about all contact lists for the account. <div class="Msg"><p class="note-text">This method does not currently support filtering results using the contact list update date.</p></div>
162 163 164 165 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 162 def get_all_lists(opts = {}) data, _status_code, _headers = get_all_lists_with_http_info(opts) data end |
#get_all_lists_with_http_info(opts = {}) ⇒ Array<(GetAllLists200Response, Integer, Hash)>
GET Lists Collection Use this method to return details about all contact lists for the account. <div class="Msg"><p class="note-text">This method does not currently support filtering results using the contact list update date.</p></div>
176 177 178 179 180 181 182 183 184 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 237 238 239 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 176 def get_all_lists_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.get_all_lists ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactListsApi.get_all_lists, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactListsApi.get_all_lists, must be greater than or equal to 1.' end allowable_values = ["all", "active"] if @api_client.config.client_side_validation && opts[:'include_membership_count'] && !allowable_values.include?(opts[:'include_membership_count']) fail ArgumentError, "invalid value for \"include_membership_count\", must be one of #{allowable_values}" end allowable_values = ["all", "active", "deleted"] if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status']) fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}" end # resource path local_var_path = '/contact_lists' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'include_count'] = opts[:'include_count'] if !opts[:'include_count'].nil? query_params[:'include_membership_count'] = opts[:'include_membership_count'] if !opts[:'include_membership_count'].nil? query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].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] || 'GetAllLists200Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.get_all_lists", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#get_all_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_list(list_id, opts = {}) ⇒ GetList200Response
GET a List Use this method to get details about a specific contact list (‘list_id`).
247 248 249 250 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 247 def get_list(list_id, opts = {}) data, _status_code, _headers = get_list_with_http_info(list_id, opts) data end |
#get_list_id_xrefs(sequence_ids, opts = {}) ⇒ GetListIdXrefs200Response
GET a collection of V2 and V3 API List IDs <div class="Msg Msg–warning"><p class="note-text">Use this endpoint to migrate your locally stored V2 contact list data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.</p></div> This GET call retrieves a collection of cross-referenced list sequence IDs (‘id` used in the V2 API) and UUIDs (`list_id` used in the V3 API). This endpoint is intended for developers who have an existing V2 API integration, and are migrating their users to a new V3 API integration. The V2 and V3 APIs use different resource ID formats. Use the `sequence_ids` query parameter to specify a set of comma delimited V2 list ids to cross-reference. See [Migrating Apps and Data to V3](/api_guide/migration_overview.html) to learn more."
316 317 318 319 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 316 def get_list_id_xrefs(sequence_ids, opts = {}) data, _status_code, _headers = get_list_id_xrefs_with_http_info(sequence_ids, opts) data end |
#get_list_id_xrefs_with_http_info(sequence_ids, opts = {}) ⇒ Array<(GetListIdXrefs200Response, Integer, Hash)>
GET a collection of V2 and V3 API List IDs <div class="Msg Msg–warning"><p class="note-text">Use this endpoint to migrate your locally stored V2 contact list data to the new V3 format. Developers are expected to use this endpoint sparingly. This endpoint is NOT intended for regular or repeated use. Constant Contact will eventually deprecate and remove this endpoint.</p></div> This GET call retrieves a collection of cross-referenced list sequence IDs (`id` used in the V2 API) and UUIDs (`list_id` used in the V3 API). This endpoint is intended for developers who have an existing V2 API integration, and are migrating their users to a new V3 API integration. The V2 and V3 APIs use different resource ID formats. Use the `sequence_ids` query parameter to specify a set of comma delimited V2 list ids to cross-reference. See [Migrating Apps and Data to V3](/api_guide/migration_overview.html) to learn more."
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 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 326 def get_list_id_xrefs_with_http_info(sequence_ids, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.get_list_id_xrefs ...' end # verify the required parameter 'sequence_ids' is set if @api_client.config.client_side_validation && sequence_ids.nil? fail ArgumentError, "Missing the required parameter 'sequence_ids' when calling ContactListsApi.get_list_id_xrefs" end # resource path local_var_path = '/contact_lists/list_id_xrefs' # query parameters query_params = opts[:query_params] || {} query_params[:'sequence_ids'] = sequence_ids # 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] || 'GetListIdXrefs200Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.get_list_id_xrefs", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#get_list_id_xrefs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetList200Response, Integer, Hash)>
GET a List Use this method to get details about a specific contact list (`list_id`).
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 308 309 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 258 def get_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.get_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactListsApi.get_list" end allowable_values = ["all", "active"] if @api_client.config.client_side_validation && opts[:'include_membership_count'] && !allowable_values.include?(opts[:'include_membership_count']) fail ArgumentError, "invalid value for \"include_membership_count\", must be one of #{allowable_values}" end # resource path local_var_path = '/contact_lists/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'include_membership_count'] = opts[:'include_membership_count'] if !opts[:'include_membership_count'].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] || 'GetList200Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.get_list", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#get_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_list(list_id, update_list_request, opts = {}) ⇒ UpdateList200Response
PUT (update) a List Updates an existing contact list resource, specified by ‘list_id`
381 382 383 384 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 381 def update_list(list_id, update_list_request, opts = {}) data, _status_code, _headers = update_list_with_http_info(list_id, update_list_request, opts) data end |
#update_list_with_http_info(list_id, update_list_request, opts = {}) ⇒ Array<(UpdateList200Response, Integer, Hash)>
PUT (update) a List Updates an existing contact list resource, specified by `list_id`
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 444 445 446 447 |
# File 'lib/constant_contact_client/api/contact_lists_api.rb', line 392 def update_list_with_http_info(list_id, update_list_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactListsApi.update_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactListsApi.update_list" end # verify the required parameter 'update_list_request' is set if @api_client.config.client_side_validation && update_list_request.nil? fail ArgumentError, "Missing the required parameter 'update_list_request' when calling ContactListsApi.update_list" end # resource path local_var_path = '/contact_lists/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_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']) # 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(update_list_request) # return_type return_type = opts[:debug_return_type] || 'UpdateList200Response' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit'] = opts.merge( :operation => :"ContactListsApi.update_list", :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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactListsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |