Class: ConstantContactClient::ContactTagsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactTagsApi

Returns a new instance of ContactTagsApi.



19
20
21
# File 'lib/constant_contact_client/api/contact_tags_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/contact_tags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_tag(tag_id, opts = {}) ⇒ DeleteTag202Response

DELETE a Tag Use this method to create an activity used to un-assign a tag from all assigned contacts and delete the tag. This is an asynchronous activity. To view activity details for the delete request, use the href link returned in the response. [Learn more](/api_guide/tags_delete.html).

Parameters:

  • tag_id (String)

    The ID that uniquely identifies a tag in UUID format.

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 27

def delete_tag(tag_id, opts = {})
  data, _status_code, _headers = delete_tag_with_http_info(tag_id, opts)
  data
end

#delete_tag_with_http_info(tag_id, opts = {}) ⇒ Array<(DeleteTag202Response, Integer, Hash)>

DELETE a Tag Use this method to create an activity used to un-assign a tag from all assigned contacts and delete the tag. This is an asynchronous activity. To view activity details for the delete request, use the href link returned in the response. [Learn more](/api_guide/tags_delete.html).

Parameters:

  • tag_id (String)

    The ID that uniquely identifies a tag in UUID format.

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

    the optional parameters

Returns:

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

    DeleteTag202Response data, response status code and response headers



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
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 37

def delete_tag_with_http_info(tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactTagsApi.delete_tag ...'
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling ContactTagsApi.delete_tag"
  end
  # resource path
  local_var_path = '/contact_tags/{tag_id}'.sub('{' + 'tag_id' + '}', CGI.escape(tag_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] || 'DeleteTag202Response'

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

  new_options = opts.merge(
    :operation => :"ContactTagsApi.delete_tag",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactTagsApi#delete_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_tags(opts = {}) ⇒ GetAllTags200Response

GET Details for All Tags Use this endpoint to get details for all tags in your account. Use the include_count query parameter to include the total number of contacts assigned each tag. Use the limit query parameter to limit the number of tag results returned per page. To get the next page of results, copy the cursor={the cursor ID} from the resulting href link and add it (&) to the URL. For example: <p>/v3/contact_tags?limit=1&cursor=</p><p>bGltaXQ9MSZuZXh0PTJjZDgwMjdhLTc4YzAtMTFlOS1iZmQwLWZhMTYzZTZiMDFjMQ=</p> To learn more, see [Get Tags](/api_guide/tags_get.html).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Use to specify the number of tag results (up to &#x60;500&#x60;) to display per page of output. The default is &#x60;50&#x60;. (default to 50)

  • :include_count (Boolean)

    Returns the total number of contacts (&#x60;contacts_count&#x60;) to which a tag applies. (default to false)

Returns:



91
92
93
94
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 91

def get_all_tags(opts = {})
  data, _status_code, _headers = get_all_tags_with_http_info(opts)
  data
end

#get_all_tags_with_http_info(opts = {}) ⇒ Array<(GetAllTags200Response, Integer, Hash)>

GET Details for All Tags Use this endpoint to get details for all tags in your account. Use the &lt;code&gt;include_count&lt;/code&gt; query parameter to include the total number of contacts assigned each tag. Use the &lt;code&gt;limit&lt;/code&gt; query parameter to limit the number of tag results returned per page. To get the next page of results, copy the &lt;code&gt;cursor&#x3D;cursor ID&lt;/code&gt; from the resulting href link and add it (&lt;code&gt;&amp;&lt;/code&gt;) to the URL. For example: &lt;p&gt;&lt;code&gt;/v3/contact_tags?limit&#x3D;1&amp;cursor&#x3D;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;bGltaXQ9MSZuZXh0PTJjZDgwMjdhLTc4YzAtMTFlOS1iZmQwLWZhMTYzZTZiMDFjMQ&#x3D;&lt;/code&gt;&lt;/p&gt; To learn more, see [Get Tags](/api_guide/tags_get.html).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Use to specify the number of tag results (up to &#x60;500&#x60;) to display per page of output. The default is &#x60;50&#x60;. (default to 50)

  • :include_count (Boolean)

    Returns the total number of contacts (&#x60;contacts_count&#x60;) to which a tag applies. (default to false)

Returns:

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

    GetAllTags200Response data, response status code and response headers



102
103
104
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
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 102

def get_all_tags_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactTagsApi.get_all_tags ...'
  end
  # resource path
  local_var_path = '/contact_tags'

  # 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?

  # 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] || 'GetAllTags200Response'

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

  new_options = opts.merge(
    :operation => :"ContactTagsApi.get_all_tags",
    :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: ContactTagsApi#get_all_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tag(tag_id, opts = {}) ⇒ GetTag200Response

GET Tag Details Use this method to get tag details for a specified ‘tag_id`. Use the `include_count` query parameter to include or exclude the total number of contacts to which this tag is assigned. To learn more, see [Get a Tag’s Details](/api_guide/tags_get_single.html).

Parameters:

  • tag_id (String)

    The ID that uniquely identifies a tag (UUID format).

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

    the optional parameters

Options Hash (opts):

  • :include_count (Boolean)

    Use to include (&#x60;true&#x60;) or exclude (&#x60;false&#x60;) the total number of tagged contacts (&#x60;contacts_count&#x60;) from the results. (default to false)

Returns:



154
155
156
157
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 154

def get_tag(tag_id, opts = {})
  data, _status_code, _headers = get_tag_with_http_info(tag_id, opts)
  data
end

#get_tag_with_http_info(tag_id, opts = {}) ⇒ Array<(GetTag200Response, Integer, Hash)>

GET Tag Details Use this method to get tag details for a specified &#x60;tag_id&#x60;. Use the &#x60;include_count&#x60; query parameter to include or exclude the total number of contacts to which this tag is assigned. To learn more, see [Get a Tag&#39;s Details](/api_guide/tags_get_single.html).

Parameters:

  • tag_id (String)

    The ID that uniquely identifies a tag (UUID format).

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

    the optional parameters

Options Hash (opts):

  • :include_count (Boolean)

    Use to include (&#x60;true&#x60;) or exclude (&#x60;false&#x60;) the total number of tagged contacts (&#x60;contacts_count&#x60;) from the results. (default to false)

Returns:

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

    GetTag200Response data, response status code and response headers



165
166
167
168
169
170
171
172
173
174
175
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
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 165

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_count'] = opts[:'include_count'] if !opts[:'include_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] || 'GetTag200Response'

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

  new_options = opts.merge(
    :operation => :"ContactTagsApi.get_tag",
    :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: ContactTagsApi#get_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_tag(post_tag_request, opts = {}) ⇒ GetTag200Response

POST (Create) a Tag Use this method to create a new tag. The tag ‘name` is required and must be unique and can include most common keyboard symbols. Optionally, when creating a new tag you can specify the source (`tag_source`) used to identify the contacts to tag in the request body. [Learn more](/api_guide/tags_create.html).

Parameters:

  • post_tag_request (PostTagRequest)

    The JSON payload to use to create a new tag.

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

    the optional parameters

Returns:



219
220
221
222
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 219

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

#post_tag_with_http_info(post_tag_request, opts = {}) ⇒ Array<(GetTag200Response, Integer, Hash)>

POST (Create) a Tag Use this method to create a new tag. The tag &#x60;name&#x60; is required and must be unique and can include most common keyboard symbols. Optionally, when creating a new tag you can specify the source (&#x60;tag_source&#x60;) used to identify the contacts to tag in the request body. [Learn more](/api_guide/tags_create.html).

Parameters:

  • post_tag_request (PostTagRequest)

    The JSON payload to use to create a new tag.

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

    the optional parameters

Returns:

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

    GetTag200Response data, response status code and response headers



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 229

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

  # 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()

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

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

  new_options = opts.merge(
    :operation => :"ContactTagsApi.post_tag",
    :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: ContactTagsApi#post_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_tag(tag_id, put_tag_request, opts = {}) ⇒ GetTag200Response

PUT (Update) a Tag Use this method to rename an existing tag to a new unique tag name (‘name`). The maximum length is 255 characters. The `tag_source` value cannot be updated using this method. You can set the `tag_source` value using the `POST contact_tags method`. [Learn more](/api_guide/tags_update.html)

Parameters:

  • tag_id (String)

    The system generated ID used to uniquely identify the tag that you want to rename (UUID format).

  • put_tag_request (PutTagRequest)

    The JSON payload used to update the tag name (&#x60;name&#x60;).

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

    the optional parameters

Returns:



288
289
290
291
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 288

def put_tag(tag_id, put_tag_request, opts = {})
  data, _status_code, _headers = put_tag_with_http_info(tag_id, put_tag_request, opts)
  data
end

#put_tag_with_http_info(tag_id, put_tag_request, opts = {}) ⇒ Array<(GetTag200Response, Integer, Hash)>

PUT (Update) a Tag Use this method to rename an existing tag to a new unique tag name (&#x60;name&#x60;). The maximum length is 255 characters. The &#x60;tag_source&#x60; value cannot be updated using this method. You can set the &#x60;tag_source&#x60; value using the &#x60;POST contact_tags method&#x60;. [Learn more](/api_guide/tags_update.html)

Parameters:

  • tag_id (String)

    The system generated ID used to uniquely identify the tag that you want to rename (UUID format).

  • put_tag_request (PutTagRequest)

    The JSON payload used to update the tag name (&#x60;name&#x60;).

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

    the optional parameters

Returns:

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

    GetTag200Response data, response status code and response headers



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
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
# File 'lib/constant_contact_client/api/contact_tags_api.rb', line 299

def put_tag_with_http_info(tag_id, put_tag_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactTagsApi.put_tag ...'
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling ContactTagsApi.put_tag"
  end
  # verify the required parameter 'put_tag_request' is set
  if @api_client.config.client_side_validation && put_tag_request.nil?
    fail ArgumentError, "Missing the required parameter 'put_tag_request' when calling ContactTagsApi.put_tag"
  end
  # resource path
  local_var_path = '/contact_tags/{tag_id}'.sub('{' + 'tag_id' + '}', CGI.escape(tag_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(put_tag_request)

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

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

  new_options = opts.merge(
    :operation => :"ContactTagsApi.put_tag",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactTagsApi#put_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end