Class: PinterestSdkClient::AdAccountsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pinterest_sdk/api/ad_accounts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdAccountsApi

Returns a new instance of AdAccountsApi.



19
20
21
# File 'lib/pinterest_sdk/api/ad_accounts_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/pinterest_sdk/api/ad_accounts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#ad_account_analytics(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<AdAccountAnalyticsItems>

Get ad account analytics Get analytics for the specified ad_account_id, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. - If granularity is not HOUR, you can pull data from up to 90 days before the current date in UTC time, with a maximum time range of 90 days. - If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time.

Parameters:

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days back from today.

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days past start_date.

  • columns (Array<ReportingColumnSync>)

    Columns to retrieve, encoded as a comma-separated string. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD, ($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency. For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound). If a column has no value, it may not be returned.

  • granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Options Hash (opts):

  • :click_window_days (Float)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. (default to 30)

  • :engagement_window_days (Float)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. Note: This parameter no longer returns new data. However, you can still access historic data through Sept 30, 2027. (default to 30)

  • :view_window_days (Float)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')

  • :reporting_timezone (ReportingTimeZone)

    Specify the timezone to be applied for the reporting. This feature is currently in BETA and is not available to all users.

Returns:



36
37
38
39
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 36

def (start_date, end_date, columns, granularity, , opts = {})
  data, _status_code, _headers = (start_date, end_date, columns, granularity, , opts)
  data
end

#ad_account_analytics_with_http_info(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<(Array<AdAccountAnalyticsItems>, Integer, Hash)>

Get ad account analytics Get analytics for the specified `ad_account_id`, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. - If granularity is not HOUR, you can pull data from up to 90 days before the current date in UTC time, with a maximum time range of 90 days. - If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time.

Parameters:

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days back from today.

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days past start_date.

  • columns (Array<ReportingColumnSync>)

    Columns to retrieve, encoded as a comma-separated string. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD, ($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency. For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound). If a column has no value, it may not be returned.

  • granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Options Hash (opts):

  • :click_window_days (Float)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. (default to 30)

  • :engagement_window_days (Float)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. Note: This parameter no longer returns new data. However, you can still access historic data through Sept 30, 2027. (default to 30)

  • :view_window_days (Float)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')

  • :reporting_timezone (ReportingTimeZone)

    Specify the timezone to be applied for the reporting. This feature is currently in BETA and is not available to all users.

Returns:

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

    Array data, response status code and response headers



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
147
148
149
150
151
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 55

def (start_date, end_date, columns, granularity, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_account_analytics ...'
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_account_analytics"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.ad_account_analytics, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_account_analytics, must conform to the pattern #{pattern}."
  end

  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/analytics'.sub('{ad_account_id}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
  query_params[:'reporting_timezone'] = opts[:'reporting_timezone'] if !opts[:'reporting_timezone'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<AdAccountAnalyticsItems>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

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

#ad_account_targeting_analytics_get(ad_account_id, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ MetricsResponse

Get targeting analytics for an ad account Get targeting analytics for an ad account. For the requested account and metrics, the response will include the requested metric information (e.g. SPEND_IN_DOLLAR) for the requested target type (e.g. "age_bucket") for applicable values (e.g. "45-49").

* The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. * If granularity is not HOUR, you can pull data from up to 90 days before the current date in UTC time, with a maximum time range of 90 days. * If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time, with a maximum time range of 3 days.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days back from today.

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days past start_date.

  • targeting_types (Array<AdsAnalyticsAccountTargetingType>)

    Targeting type breakdowns for the report. The reporting per targeting type is independent from each other. [&quot;AGE_BUCKET_AND_GENDER&quot;] is in BETA and not yet available to all users.

  • columns (Array<ReportingColumnSync>)

    Columns to retrieve, encoded as a comma-separated string. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD, ($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency. For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound). If a column has no value, it may not be returned.

  • granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

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

    the optional parameters

Options Hash (opts):

  • :click_window_days (Float)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. (default to 30)

  • :engagement_window_days (Float)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. Note: This parameter no longer returns new data. However, you can still access historic data through Sept 30, 2027. (default to 30)

  • :view_window_days (Float)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')

  • :attribution_types (Array<ConversionReportAttributionType>)

    List of types of attribution for the conversion report

  • :reporting_timezone (ReportingTimeZone)

    Specify the timezone to be applied for the reporting. This feature is currently in BETA and is not available to all users.

Returns:



169
170
171
172
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 169

def (, start_date, end_date, targeting_types, columns, granularity, opts = {})
  data, _status_code, _headers = (, start_date, end_date, targeting_types, columns, granularity, opts)
  data
end

#ad_account_targeting_analytics_get_with_http_info(ad_account_id, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ Array<(MetricsResponse, Integer, Hash)>

Get targeting analytics for an ad account Get targeting analytics for an ad account. For the requested account and metrics, the response will include the requested metric information (e.g. SPEND_IN_DOLLAR) for the requested target type (e.g. &quot;age_bucket&quot;) for applicable values (e.g. &quot;45-49&quot;). <p/> * The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. * If granularity is not HOUR, you can pull data from up to 90 days before the current date in UTC time, with a maximum time range of 90 days. * If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time, with a maximum time range of 3 days.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days back from today.

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 90 days past start_date.

  • targeting_types (Array<AdsAnalyticsAccountTargetingType>)

    Targeting type breakdowns for the report. The reporting per targeting type is independent from each other. [&quot;AGE_BUCKET_AND_GENDER&quot;] is in BETA and not yet available to all users.

  • columns (Array<ReportingColumnSync>)

    Columns to retrieve, encoded as a comma-separated string. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD, ($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency. For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound). If a column has no value, it may not be returned.

  • granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

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

    the optional parameters

Options Hash (opts):

  • :click_window_days (Float)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. (default to 30)

  • :engagement_window_days (Float)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days. Note: This parameter no longer returns new data. However, you can still access historic data through Sept 30, 2027. (default to 30)

  • :view_window_days (Float)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')

  • :attribution_types (Array<ConversionReportAttributionType>)

    List of types of attribution for the conversion report

  • :reporting_timezone (ReportingTimeZone)

    Specify the timezone to be applied for the reporting. This feature is currently in BETA and is not available to all users.

Returns:

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

    MetricsResponse data, response status code and response headers



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
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
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/pinterest_sdk/api/ad_accounts_api.rb', line 190

def (, start_date, end_date, targeting_types, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_account_targeting_analytics_get ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.ad_account_targeting_analytics_get, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_account_targeting_analytics_get, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  # verify the required parameter 'targeting_types' is set
  if @api_client.config.client_side_validation && targeting_types.nil?
    fail ArgumentError, "Missing the required parameter 'targeting_types' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  if @api_client.config.client_side_validation && targeting_types.length > 15
    fail ArgumentError, 'invalid value for "targeting_types" when calling AdAccountsApi.ad_account_targeting_analytics_get, number of items must be less than or equal to 15.'
  end

  if @api_client.config.client_side_validation && targeting_types.length < 1
    fail ArgumentError, 'invalid value for "targeting_types" when calling AdAccountsApi.ad_account_targeting_analytics_get, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_account_targeting_analytics_get"
  end
  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1, 7, 14, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'attribution_types'].nil? && opts[:'attribution_types'].length > 2
    fail ArgumentError, 'invalid value for "opts[:"attribution_types"]" when calling AdAccountsApi.ad_account_targeting_analytics_get, number of items must be less than or equal to 2.'
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/targeting_analytics'.sub('{ad_account_id}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'targeting_types'] = @api_client.build_collection_param(targeting_types, :csv)
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
  query_params[:'attribution_types'] = @api_client.build_collection_param(opts[:'attribution_types'], :csv) if !opts[:'attribution_types'].nil?
  query_params[:'reporting_timezone'] = opts[:'reporting_timezone'] if !opts[:'reporting_timezone'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

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

#ad_accounts_create(ad_account_create, opts = {}) ⇒ AdAccount

Create ad account Create a new ad account. Different ad accounts can support different currencies, payment methods, etc. An ad account is needed to create campaigns, ad groups, and ads; other accounts (your employees or partners) can be assigned business access and appropriate roles to access an ad account. You can set up up to 50 ad accounts per user. (The user must have a business account to create an ad account.) For more, see Create an advertiser account.

Parameters:

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

    the optional parameters

Returns:



311
312
313
314
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 311

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

#ad_accounts_create_with_http_info(ad_account_create, opts = {}) ⇒ Array<(AdAccount, Integer, Hash)>

Create ad account Create a new ad account. Different ad accounts can support different currencies, payment methods, etc. An ad account is needed to create campaigns, ad groups, and ads; other accounts (your employees or partners) can be assigned business access and appropriate roles to access an ad account. You can set up up to 50 ad accounts per user. (The user must have a business account to create an ad account.) For more, see Create an advertiser account.

Parameters:

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

    the optional parameters

Returns:

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

    AdAccount data, response status code and response headers



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/pinterest_sdk/api/ad_accounts_api.rb', line 321

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

  # 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']) unless header_params['Accept']
  # 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] || 'AdAccount'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#ad_accounts_get(ad_account_id, opts = {}) ⇒ AdAccount

Get ad account Get an ad account

Parameters:

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

    the optional parameters

Returns:



379
380
381
382
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 379

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

#ad_accounts_get_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AdAccount, Integer, Hash)>

Get ad account Get an ad account

Parameters:

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

    the optional parameters

Returns:

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

    AdAccount data, response status code and response headers



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
441
442
443
444
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 389

def ad_accounts_get_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_accounts_get ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_accounts_get"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.ad_accounts_get, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_accounts_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}'.sub('{ad_account_id}', CGI.escape(.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']) unless header_params['Accept']

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

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

#ad_accounts_list(opts = {}) ⇒ AdAccountsList200Response

List ad accounts Get a list of the ad_accounts that the "operation user_account" has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them Business Access.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_shared_accounts (Boolean)

    Include shared ad accounts (default to true)

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:



453
454
455
456
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 453

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

#ad_accounts_list_with_http_info(opts = {}) ⇒ Array<(AdAccountsList200Response, Integer, Hash)>

List ad accounts Get a list of the ad_accounts that the &quot;operation user_account&quot; has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them Business Access.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_shared_accounts (Boolean)

    Include shared ad accounts (default to true)

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:

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

    AdAccountsList200Response data, response status code and response headers



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 465

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

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

  # resource path
  local_var_path = '/ad_accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_shared_accounts'] = opts[:'include_shared_accounts'] if !opts[:'include_shared_accounts'].nil?
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

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

#analytics_create_conversion_product_report(ad_account_id, conversion_product_report_create, opts = {}) ⇒ ConversionProductReport

Create a request for a brand, category, SKU report Restricted This creates an asynchronous brand, category, SKU report based on the given request. This request returns a token that you can use to download the report when it is ready.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:



526
527
528
529
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 526

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

#analytics_create_conversion_product_report_with_http_info(ad_account_id, conversion_product_report_create, opts = {}) ⇒ Array<(ConversionProductReport, Integer, Hash)>

Create a request for a brand, category, SKU report Restricted This creates an asynchronous brand, category, SKU report based on the given request. This request returns a token that you can use to download the report when it is ready.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:

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

    ConversionProductReport data, response status code and response headers



537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 537

def analytics_create_conversion_product_report_with_http_info(, conversion_product_report_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_conversion_product_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_conversion_product_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_create_conversion_product_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_conversion_product_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'conversion_product_report_create' is set
  if @api_client.config.client_side_validation && conversion_product_report_create.nil?
    fail ArgumentError, "Missing the required parameter 'conversion_product_report_create' when calling AdAccountsApi.analytics_create_conversion_product_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports/brand_category_sku'.sub('{ad_account_id}', CGI.escape(.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']) unless header_params['Accept']
  # 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(conversion_product_report_create)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_create_mmm_report(ad_account_id, mmm_report_create, opts = {}) ⇒ MMMReport

Create a request for a Marketing Mix Modeling (MMM) report This creates an asynchronous mmm report based on the given request. It returns a token that you can use to download the report when it is ready. NOTE: An additional limit of 5 queries per minute per advertiser applies to this endpoint while it's in beta release. For the ADVERTISER_PAID_SPEND_IN_DOLLAR, ADVERTISER_PAID_ECPC_IN_DOLLAR, and ADVERTISER_PAID_ECPM_IN_DOLLAR columns: if you receive bonus media, this value still includes that spend, and it will need to be removed manually with support from your Pinterest account team for a fully netted value. Over time, we'll also subtract bonus media and other incentives as data becomes available. Production and other non-media fees are excluded.

Parameters:

  • ad_account_id (String)
  • mmm_report_create (MMMReportCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



609
610
611
612
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 609

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

#analytics_create_mmm_report_with_http_info(ad_account_id, mmm_report_create, opts = {}) ⇒ Array<(MMMReport, Integer, Hash)>

Create a request for a Marketing Mix Modeling (MMM) report This creates an asynchronous mmm report based on the given request. It returns a token that you can use to download the report when it is ready. NOTE: An additional limit of 5 queries per minute per advertiser applies to this endpoint while it's in beta release. For the ADVERTISER_PAID_SPEND_IN_DOLLAR, ADVERTISER_PAID_ECPC_IN_DOLLAR, and ADVERTISER_PAID_ECPM_IN_DOLLAR columns: if you receive bonus media, this value still includes that spend, and it will need to be removed manually with support from your Pinterest account team for a fully netted value. Over time, we'll also subtract bonus media and other incentives as data becomes available. Production and other non-media fees are excluded.

Parameters:

  • ad_account_id (String)
  • mmm_report_create (MMMReportCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MMMReport data, response status code and response headers



620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 620

def analytics_create_mmm_report_with_http_info(, mmm_report_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_mmm_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_mmm_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_create_mmm_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_mmm_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'mmm_report_create' is set
  if @api_client.config.client_side_validation && mmm_report_create.nil?
    fail ArgumentError, "Missing the required parameter 'mmm_report_create' when calling AdAccountsApi.analytics_create_mmm_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/mmm_reports'.sub('{ad_account_id}', CGI.escape(.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']) unless header_params['Accept']
  # 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(mmm_report_create)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_create_report(ad_account_id, ads_analytics_create_async_request, opts = {}) ⇒ AdsAnalyticsCreateAsyncResponse

Create async request for an account analytics report This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. - If granularity is not HOUR, you can pull data from up to 914 days before the current date in UTC time, with a maximum time range of 186 days. - If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time, with a maximum time range of 3 days. - If level is PRODUCT_ITEM, you can pull data from up to 92 days before the current date in UTC time, with a maximum time range of 31 days. - If level is PRODUCT_ITEM, ad_ids and ad_statuses parameters are not allowed. Any columns related to pin promotion and ad is not allowed either.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:



692
693
694
695
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 692

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

#analytics_create_report_with_http_info(ad_account_id, ads_analytics_create_async_request, opts = {}) ⇒ Array<(AdsAnalyticsCreateAsyncResponse, Integer, Hash)>

Create async request for an account analytics report This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager. - If granularity is not HOUR, you can pull data from up to 914 days before the current date in UTC time, with a maximum time range of 186 days. - If granularity is HOUR, you can pull data from up to 8 days before the current date in UTC time, with a maximum time range of 3 days. - If level is PRODUCT_ITEM, you can pull data from up to 92 days before the current date in UTC time, with a maximum time range of 31 days. - If level is PRODUCT_ITEM, ad_ids and ad_statuses parameters are not allowed. Any columns related to pin promotion and ad is not allowed either.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:



703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
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
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 703

def analytics_create_report_with_http_info(, ads_analytics_create_async_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_create_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'ads_analytics_create_async_request' is set
  if @api_client.config.client_side_validation && ads_analytics_create_async_request.nil?
    fail ArgumentError, "Missing the required parameter 'ads_analytics_create_async_request' when calling AdAccountsApi.analytics_create_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{ad_account_id}', CGI.escape(.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']) unless header_params['Accept']
  # 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(ads_analytics_create_async_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_create_template_report(ad_account_id, template_id, opts = {}) ⇒ TemplateBasedReport

Create async request for an analytics report using a template This takes a template ID and an optional custom timeframe and constructs an asynchronous report based on the template. It returns a token that you can use to download the report when it is ready.

Parameters:

  • ad_account_id (String)
  • template_id (String)

    Unique identifier of a template.

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 2.5 years back from today.

  • :end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 2.5 years past start date.

  • :granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

Returns:



778
779
780
781
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 778

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

#analytics_create_template_report_with_http_info(ad_account_id, template_id, opts = {}) ⇒ Array<(TemplateBasedReport, Integer, Hash)>

Create async request for an analytics report using a template This takes a template ID and an optional custom timeframe and constructs an asynchronous report based on the template. It returns a token that you can use to download the report when it is ready.

Parameters:

  • ad_account_id (String)
  • template_id (String)

    Unique identifier of a template.

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

    the optional parameters

Options Hash (opts):

  • :start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD. Cannot be more than 2.5 years back from today.

  • :end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD. Cannot be more than 2.5 years past start date.

  • :granularity (Granularity)

    TOTAL - metrics are aggregated over the specified date range. DAY - metrics are broken down daily. HOUR - metrics are broken down hourly. WEEK - metrics are broken down weekly. MONTH - metrics are broken down monthly

Returns:

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

    TemplateBasedReport data, response status code and response headers



792
793
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
851
852
853
854
855
856
857
858
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 792

def analytics_create_template_report_with_http_info(, template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_template_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_template_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_create_template_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_template_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling AdAccountsApi.analytics_create_template_report"
  end
  if @api_client.config.client_side_validation && template_id.to_s.length > 18
    fail ArgumentError, 'invalid value for "template_id" when calling AdAccountsApi.analytics_create_template_report, the character length must be smaller than or equal to 18.'
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/templates/{template_id}/reports'.sub('{ad_account_id}', CGI.escape(.to_s)).sub('{template_id}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_get_conversion_product_report(ad_account_id, token, opts = {}) ⇒ ConversionProductReport

Get advertiser brand, category, SKU report Restricted Get a brand, category, SKU report for an ad account. This call returns the URL for the report that matches the token returned in the request to the Create brand, category, SKU report endpoint.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:



866
867
868
869
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 866

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

#analytics_get_conversion_product_report_with_http_info(ad_account_id, token, opts = {}) ⇒ Array<(ConversionProductReport, Integer, Hash)>

Get advertiser brand, category, SKU report Restricted Get a brand, category, SKU report for an ad account. This call returns the URL for the report that matches the token returned in the request to the Create brand, category, SKU report endpoint.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:

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

    ConversionProductReport data, response status code and response headers



877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 877

def analytics_get_conversion_product_report_with_http_info(, token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_get_conversion_product_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_get_conversion_product_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_get_conversion_product_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_get_conversion_product_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'token' is set
  if @api_client.config.client_side_validation && token.nil?
    fail ArgumentError, "Missing the required parameter 'token' when calling AdAccountsApi.analytics_get_conversion_product_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports/brand_category_sku'.sub('{ad_account_id}', CGI.escape(.to_s))

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

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_get_mmm_report(ad_account_id, token, opts = {}) ⇒ MMMReport

Get advertiser Marketing Mix Modeling (MMM) report. Get an mmm report for an ad account. This returns a URL to an mmm metrics report given a token returned from the create mmm report endpoint.

Parameters:

  • ad_account_id (String)
  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:



945
946
947
948
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 945

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

#analytics_get_mmm_report_with_http_info(ad_account_id, token, opts = {}) ⇒ Array<(MMMReport, Integer, Hash)>

Get advertiser Marketing Mix Modeling (MMM) report. Get an mmm report for an ad account. This returns a URL to an mmm metrics report given a token returned from the create mmm report endpoint.

Parameters:

  • ad_account_id (String)
  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:

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

    MMMReport data, response status code and response headers



956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 956

def analytics_get_mmm_report_with_http_info(, token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_get_mmm_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_get_mmm_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_get_mmm_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_get_mmm_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'token' is set
  if @api_client.config.client_side_validation && token.nil?
    fail ArgumentError, "Missing the required parameter 'token' when calling AdAccountsApi.analytics_get_mmm_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/mmm_reports'.sub('{ad_account_id}', CGI.escape(.to_s))

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

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#analytics_get_report(ad_account_id, token, opts = {}) ⇒ AdsAnalyticsGetAsyncResponse

Get the account analytics report created by the async call This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report. The link is valid for five minutes and the report is valid for one hour. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:



1024
1025
1026
1027
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1024

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

#analytics_get_report_with_http_info(ad_account_id, token, opts = {}) ⇒ Array<(AdsAnalyticsGetAsyncResponse, Integer, Hash)>

Get the account analytics report created by the async call This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report. The link is valid for five minutes and the report is valid for one hour. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via Business Access: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

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

    the optional parameters

Returns:



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1035

def analytics_get_report_with_http_info(, token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_get_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_get_report"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.analytics_get_report, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_get_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'token' is set
  if @api_client.config.client_side_validation && token.nil?
    fail ArgumentError, "Missing the required parameter 'token' when calling AdAccountsApi.analytics_get_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{ad_account_id}', CGI.escape(.to_s))

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

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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

#sandbox_delete(ad_account_id, opts = {}) ⇒ String

Delete ads data for ad account in API Sandbox Delete an ad account and all the ads data associated with that account. A string message is returned indicating the status of the delete operation. Note: This endpoint is only allowed in the Pinterest API Sandbox (https://api-sandbox.pinterest.com/v5). Go to /docs/developer-tools/sandbox/ for more information.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:

  • (String)


1102
1103
1104
1105
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1102

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

#sandbox_delete_with_http_info(ad_account_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Delete ads data for ad account in API Sandbox Delete an ad account and all the ads data associated with that account. A string message is returned indicating the status of the delete operation. Note: This endpoint is only allowed in the Pinterest API Sandbox (https://api-sandbox.pinterest.com/v5). Go to /docs/developer-tools/sandbox/ for more information.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1112

def sandbox_delete_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.sandbox_delete ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.sandbox_delete"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.sandbox_delete, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.sandbox_delete, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/sandbox'.sub('{ad_account_id}', CGI.escape(.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']) unless header_params['Accept']

  # 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] || ['pinterest_oauth2']

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

#templates_list(ad_account_id, opts = {}) ⇒ TemplatesList200Response

List templates Gets all Templates associated with an ad account ID.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Options Hash (opts):

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

  • :order (PinterestLibPaginationOrder)

    The order in which to sort the items returned: &quot;ASCENDING&quot; or &quot;DESCENDING&quot; by ID. Note that higher-value IDs are associated with more-recently added items.

Returns:



1177
1178
1179
1180
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1177

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

#templates_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(TemplatesList200Response, Integer, Hash)>

List templates Gets all Templates associated with an ad account ID.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

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

    the optional parameters

Options Hash (opts):

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

  • :order (PinterestLibPaginationOrder)

    The order in which to sort the items returned: &quot;ASCENDING&quot; or &quot;DESCENDING&quot; by ID. Note that higher-value IDs are associated with more-recently added items.

Returns:

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

    TemplatesList200Response data, response status code and response headers



1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1190

def templates_list_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.templates_list ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.templates_list"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdAccountsApi.templates_list, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.templates_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 250
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.templates_list, must be smaller than or equal to 250.'
  end

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/templates'.sub('{ad_account_id}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

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