Class: ConstantContactClient::ContactsReportingApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactsReportingApi

Returns a new instance of ContactsReportingApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_contact_open_click_rate_report(contact_id, start, _end, opts = {}) ⇒ GetContactOpenClickRateReport200Response

GET Average Open and Click Rates <p>Gets the average open and click rate for a given account and contact.<p>Looks at all tracking activities for bulk emails from a given contact over the given date range. Range cannot exceed 5 years.</p><p>Returns the rates and the number of campaign activities that were included in the calculation.</p><p>If no activities fall into the given date range, all rates will return 0 and the number of included activities will be 0.</p>

Parameters:

  • contact_id (String)

    The contact id which is requesting tracking activity data (e.g. aa9ff7b0-478d-11e6-8059-00163e3c8e19)

  • start (String)

    The starting date, in ISO 8601 format, to use to get campaigns. For example: 2019-01-01T00:00:00-0500.

  • _end (String)

    The ending date, in ISO 8601 format, to use to get campaigns. For example: 2019-12-01T00:00:00-0500.

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

    the optional parameters

Returns:



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

def get_contact_open_click_rate_report(contact_id, start, _end, opts = {})
  data, _status_code, _headers = get_contact_open_click_rate_report_with_http_info(contact_id, start, _end, opts)
  data
end

#get_contact_open_click_rate_report_with_http_info(contact_id, start, _end, opts = {}) ⇒ Array<(GetContactOpenClickRateReport200Response, Integer, Hash)>

GET Average Open and Click Rates &lt;p&gt;Gets the average open and click rate for a given account and contact.&lt;p&gt;Looks at all tracking activities for bulk emails from a given contact over the given date range. Range cannot exceed 5 years.&lt;/p&gt;&lt;p&gt;Returns the rates and the number of campaign activities that were included in the calculation.&lt;/p&gt;&lt;p&gt;If no activities fall into the given date range, all rates will return 0 and the number of included activities will be 0.&lt;/p&gt;

Parameters:

  • contact_id (String)

    The contact id which is requesting tracking activity data (e.g. aa9ff7b0-478d-11e6-8059-00163e3c8e19)

  • start (String)

    The starting date, in ISO 8601 format, to use to get campaigns. For example: 2019-01-01T00:00:00-0500.

  • _end (String)

    The ending date, in ISO 8601 format, to use to get campaigns. For example: 2019-12-01T00:00:00-0500.

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

    the optional parameters

Returns:



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

def get_contact_open_click_rate_report_with_http_info(contact_id, start, _end, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsReportingApi.get_contact_open_click_rate_report ...'
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactsReportingApi.get_contact_open_click_rate_report"
  end
  # verify the required parameter 'start' is set
  if @api_client.config.client_side_validation && start.nil?
    fail ArgumentError, "Missing the required parameter 'start' when calling ContactsReportingApi.get_contact_open_click_rate_report"
  end
  # verify the required parameter '_end' is set
  if @api_client.config.client_side_validation && _end.nil?
    fail ArgumentError, "Missing the required parameter '_end' when calling ContactsReportingApi.get_contact_open_click_rate_report"
  end
  # resource path
  local_var_path = '/reports/contact_reports/{contact_id}/open_and_click_rates'.sub('{' + 'contact_id' + '}', CGI.escape(contact_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start'] = start
  query_params[:'end'] = _end

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

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

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

#get_contact_tracking_count_report(contact_id, start, _end, opts = {}) ⇒ GetContactTrackingCountReport200Response

GET Contact Action Summary Get a list of the recent emails (aka, campaign activities) sent to a specific contact and a summary of the actions the contact took on that email for the most recent 200 campaigns.

Parameters:

  • contact_id (String)

    The contact id which is requesting tracking activity data (e.g. aa9ff7b0-478d-11e6-8059-00163e3c8e19)

  • start (String)

    The starting date, in ISO 8601 format, to use to get campaigns. For example: 2019-01-01T00:00:00-0500.

  • _end (String)

    The ending date, in ISO 8601 format, to use to get campaigns. For example: 2019-12-01T00:00:00-0500.

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

    the optional parameters

Returns:



106
107
108
109
# File 'lib/constant_contact_client/api/contacts_reporting_api.rb', line 106

def get_contact_tracking_count_report(contact_id, start, _end, opts = {})
  data, _status_code, _headers = get_contact_tracking_count_report_with_http_info(contact_id, start, _end, opts)
  data
end

#get_contact_tracking_count_report_with_http_info(contact_id, start, _end, opts = {}) ⇒ Array<(GetContactTrackingCountReport200Response, Integer, Hash)>

GET Contact Action Summary Get a list of the recent emails (aka, campaign activities) sent to a specific contact and a summary of the actions the contact took on that email for the most recent 200 campaigns.

Parameters:

  • contact_id (String)

    The contact id which is requesting tracking activity data (e.g. aa9ff7b0-478d-11e6-8059-00163e3c8e19)

  • start (String)

    The starting date, in ISO 8601 format, to use to get campaigns. For example: 2019-01-01T00:00:00-0500.

  • _end (String)

    The ending date, in ISO 8601 format, to use to get campaigns. For example: 2019-12-01T00:00:00-0500.

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

    the optional parameters

Returns:



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
169
170
171
172
173
174
# File 'lib/constant_contact_client/api/contacts_reporting_api.rb', line 118

def get_contact_tracking_count_report_with_http_info(contact_id, start, _end, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsReportingApi.get_contact_tracking_count_report ...'
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactsReportingApi.get_contact_tracking_count_report"
  end
  # verify the required parameter 'start' is set
  if @api_client.config.client_side_validation && start.nil?
    fail ArgumentError, "Missing the required parameter 'start' when calling ContactsReportingApi.get_contact_tracking_count_report"
  end
  # verify the required parameter '_end' is set
  if @api_client.config.client_side_validation && _end.nil?
    fail ArgumentError, "Missing the required parameter '_end' when calling ContactsReportingApi.get_contact_tracking_count_report"
  end
  # resource path
  local_var_path = '/reports/contact_reports/{contact_id}/activity_summary'.sub('{' + 'contact_id' + '}', CGI.escape(contact_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start'] = start
  query_params[:'end'] = _end

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

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

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

#get_contact_tracking_report(contact_id, opts = {}) ⇒ GetContactTrackingReport200Response

GET Contact Activity Details <p>Gets the tracking activity data for a single contact, sorted in descending activity date order.</p> <p>You must chose either the ‘tracking_activities_list` query parameter and or the `tracking_activity_type` query parameter to specify one or more tracking activity types In the request. The `tracking_activities_list` and `tracking_activities_type` query parameters are mutually exclusive.</p> <table><tr><td colspan=’2’>Valid tracking activity types</td></tr> <tr><td>em_sends</td><td>Send activities</td></tr> <tr><td>em_opens</td><td>Email open tracking activities</td></tr> <tr><td>em_clicks</td><td>Link click-through tracking activities</td></tr> <tr><td>em_bounces</td><td>Bounce tracking activities</td></tr> <tr><td>em_optouts</td><td>Opt-out tracking activities</td></tr><tr> <td>em_forwards</td><td>Forward to a friend tracking activities</td></tr> <tr><td>p_contact_open</td><td>Landing page opens</td></tr> <tr><td>p_contact_click</td><td>Landing page clicks</td></tr> <tr><td>p_contact_add</td><td>Landing page adds</td></tr> <tr><td>p_contact_update </td><td> Landing page updates</td></tr> </table>

Parameters:

  • contact_id (String)

    The contact&#39;s ID for which tracking activity data is requested.

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

    the optional parameters

Options Hash (opts):

  • :tracking_activities_list (Array<String>)

    Specify one or more tracking activity types to include as a comma-delimited string. The &#x60;tracking_activities_list&#x60; and &#x60;tracking_activities_type&#x60; query parameters are mutually exclusive.

  • :tracking_activity_type (Array<String>)

    Specify one or more tracking activity types to include as an array. The &#x60;tracking_activities_list&#x60; and &#x60;tracking_activities_type&#x60; query parameters are mutually exclusive.

  • :include_campaign_activity_names (Boolean)

    Default (&#x60;true&#x60;) returns campaign activity names in the results. Not including campaign activity names in the results (&#x60;false&#x60;), is more efficient. (default to true)

  • :limit (String)

    The number of tracking activities to return in a single page. Valid values are 1 to 100. Default is 100. (default to ‘100’)

Returns:



185
186
187
188
# File 'lib/constant_contact_client/api/contacts_reporting_api.rb', line 185

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

#get_contact_tracking_report_with_http_info(contact_id, opts = {}) ⇒ Array<(GetContactTrackingReport200Response, Integer, Hash)>

GET Contact Activity Details &lt;p&gt;Gets the tracking activity data for a single contact, sorted in descending activity date order.&lt;/p&gt; &lt;p&gt;You must chose either the &#x60;tracking_activities_list&#x60; query parameter and or the &#x60;tracking_activity_type&#x60; query parameter to specify one or more tracking activity types In the request. The &#x60;tracking_activities_list&#x60; and &#x60;tracking_activities_type&#x60; query parameters are mutually exclusive.&lt;/p&gt; &lt;table&gt;&lt;tr&gt;&lt;td colspan&#x3D;&#39;2&#39;&gt;Valid tracking activity types&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;em_sends&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Send activities&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;em_opens&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Email open tracking activities&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;em_clicks&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Link click-through tracking activities&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;em_bounces&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Bounce tracking activities&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;em_optouts&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Opt-out tracking activities&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;em_forwards&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Forward to a friend tracking activities&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;p_contact_open&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Landing page opens&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;p_contact_click&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Landing page clicks&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;p_contact_add&lt;/b&gt;&lt;/td&gt;&lt;td&gt;Landing page adds&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;p_contact_update &lt;/b&gt;&lt;/td&gt;&lt;td&gt; Landing page updates&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;

Parameters:

  • contact_id (String)

    The contact&#39;s ID for which tracking activity data is requested.

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

    the optional parameters

Options Hash (opts):

  • :tracking_activities_list (Array<String>)

    Specify one or more tracking activity types to include as a comma-delimited string. The &#x60;tracking_activities_list&#x60; and &#x60;tracking_activities_type&#x60; query parameters are mutually exclusive.

  • :tracking_activity_type (Array<String>)

    Specify one or more tracking activity types to include as an array. The &#x60;tracking_activities_list&#x60; and &#x60;tracking_activities_type&#x60; query parameters are mutually exclusive.

  • :include_campaign_activity_names (Boolean)

    Default (&#x60;true&#x60;) returns campaign activity names in the results. Not including campaign activity names in the results (&#x60;false&#x60;), is more efficient. (default to true)

  • :limit (String)

    The number of tracking activities to return in a single page. Valid values are 1 to 100. Default is 100. (default to ‘100’)

Returns:



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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/constant_contact_client/api/contacts_reporting_api.rb', line 199

def get_contact_tracking_report_with_http_info(contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsReportingApi.get_contact_tracking_report ...'
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactsReportingApi.get_contact_tracking_report"
  end
  allowable_values = ["em_sends", "em_opens", "em_clicks", "em_bounces", "em_optouts", "em_forwards", "p_contact_open", "p_contact_click", "p_contact_add", "p_contact_update"]
  if @api_client.config.client_side_validation && opts[:'tracking_activities_list'] && !opts[:'tracking_activities_list'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"tracking_activities_list\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/reports/contact_reports/{contact_id}/activity_details'.sub('{' + 'contact_id' + '}', CGI.escape(contact_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'tracking_activities_list'] = @api_client.build_collection_param(opts[:'tracking_activities_list'], :multi) if !opts[:'tracking_activities_list'].nil?
  query_params[:'tracking_activity_type'] = @api_client.build_collection_param(opts[:'tracking_activity_type'], :csv) if !opts[:'tracking_activity_type'].nil?
  query_params[:'include_campaign_activity_names'] = opts[:'include_campaign_activity_names'] if !opts[:'include_campaign_activity_names'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'GetContactTrackingReport200Response'

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

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