Class: PinterestSdkClient::AdGroupsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdGroupsApi

Returns a new instance of AdGroupsApi.



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

def api_client
  @api_client
end

Instance Method Details

#ad_groups_analytics(start_date, end_date, ad_group_ids, columns, granularity, ad_account_id, opts = {}) ⇒ Array<AdGroupsAnalyticsMetrics>

Get ad group analytics Get analytics for the specified ad groups in 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, with a maximum time range of 3 days.

Parameters:

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

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

  • List of Ad group Ids to use to filter the results.

  • 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.

  • 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

  • Unique identifier of an ad account.

  • (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')

  • :aggregate_report_rows (Boolean)

    Determines if report rows should be aggregated across all requested entities. This feature is currently in BETA and is not available to all users. (default to false)

  • :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:



38
39
40
41
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 38

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

#ad_groups_analytics_with_http_info(start_date, end_date, ad_group_ids, columns, granularity, ad_account_id, opts = {}) ⇒ Array<(Array<AdGroupsAnalyticsMetrics>, Integer, Hash)>

Get ad group analytics Get analytics for the specified ad groups in 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, with a maximum time range of 3 days.

Parameters:

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

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

  • List of Ad group Ids to use to filter the results.

  • 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.

  • 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

  • Unique identifier of an ad account.

  • (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')

  • :aggregate_report_rows (Boolean)

    Determines if report rows should be aggregated across all requested entities. This feature is currently in BETA and is not available to all users. (default to false)

  • :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 data, response status code and response headers



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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 59

def ad_groups_analytics_with_http_info(start_date, end_date, ad_group_ids, columns, granularity, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_analytics"
  end
  # verify the required parameter 'ad_group_ids' is set
  if @api_client.config.client_side_validation && ad_group_ids.nil?
    fail ArgumentError, "Missing the required parameter 'ad_group_ids' when calling AdGroupsApi.ad_groups_analytics"
  end
  if @api_client.config.client_side_validation && ad_group_ids.length > 250
    fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdGroupsApi.ad_groups_analytics, number of items must be less than or equal to 250.'
  end

  if @api_client.config.client_side_validation && ad_group_ids.length < 1
    fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdGroupsApi.ad_groups_analytics, 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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_analytics"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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}/ad_groups/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[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi)
  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[:'aggregate_report_rows'] = opts[:'aggregate_report_rows'] if !opts[:'aggregate_report_rows'].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<AdGroupsAnalyticsMetrics>'

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

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

#ad_groups_audience_sizing(ad_account_id, ad_group_audience_sizing_create, opts = {}) ⇒ AdGroupAudienceSizing

Get audience sizing Get potential audience size for an ad group with given targeting criteria. Potential audience size estimates the number of people you may be able to reach per month with your campaign. It is based on historical advertising data and the targeting criteria you select. It does not guarantee results or take into account factors such as bid, budget, schedule, seasonality or product experiments.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:



177
178
179
180
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 177

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

#ad_groups_audience_sizing_with_http_info(ad_account_id, ad_group_audience_sizing_create, opts = {}) ⇒ Array<(AdGroupAudienceSizing, Integer, Hash)>

Get audience sizing Get potential audience size for an ad group with given targeting criteria. Potential audience size estimates the number of people you may be able to reach per month with your campaign. It is based on historical advertising data and the targeting criteria you select. It does not guarantee results or take into account factors such as bid, budget, schedule, seasonality or product experiments.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:

  • AdGroupAudienceSizing data, response status code and response headers



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 188

def ad_groups_audience_sizing_with_http_info(, ad_group_audience_sizing_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_audience_sizing ...'
  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 AdGroupsApi.ad_groups_audience_sizing"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_audience_sizing, 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 AdGroupsApi.ad_groups_audience_sizing, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'ad_group_audience_sizing_create' is set
  if @api_client.config.client_side_validation && ad_group_audience_sizing_create.nil?
    fail ArgumentError, "Missing the required parameter 'ad_group_audience_sizing_create' when calling AdGroupsApi.ad_groups_audience_sizing"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/audience_sizing'.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(ad_group_audience_sizing_create)

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

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

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

#ad_groups_bid_floor_get(ad_account_id, bid_floor_create, opts = {}) ⇒ BidFloor

Get bid floors List bid floors for your campaign configuration. Bid floors are given in microcurrency values based on the currency in the bid floor specification. Microcurrency is used to track very small transactions, based on the currency set in the advertiser's profile. A microcurrency unit is 10^(-6) of the standard unit of currency selected in the advertiser's profile. Equivalency equations, using dollars as an example currency: * $1 = 1,000,000 microdollars * 1 microdollar = $0.000001 To convert between currency and microcurrency, using dollars as an example currency: * To convert dollars to microdollars, mutiply dollars by 1,000,000 * To convert microdollars to dollars, divide microdollars by 1,000,000 For more on bid floors see Set your bid.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:



260
261
262
263
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 260

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

#ad_groups_bid_floor_get_with_http_info(ad_account_id, bid_floor_create, opts = {}) ⇒ Array<(BidFloor, Integer, Hash)>

Get bid floors List bid floors for your campaign configuration. Bid floors are given in microcurrency values based on the currency in the bid floor specification. Microcurrency is used to track very small transactions, based on the currency set in the advertiser's profile. A microcurrency unit is 10^(-6) of the standard unit of currency selected in the advertiser's profile. Equivalency equations, using dollars as an example currency: * $1 = 1,000,000 microdollars * 1 microdollar = $0.000001 To convert between currency and microcurrency, using dollars as an example currency: * To convert dollars to microdollars, mutiply dollars by 1,000,000 * To convert microdollars to dollars, divide microdollars by 1,000,000 For more on bid floors see Set your bid.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:

  • BidFloor data, response status code and response headers



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 271

def ad_groups_bid_floor_get_with_http_info(, bid_floor_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_bid_floor_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 AdGroupsApi.ad_groups_bid_floor_get"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_bid_floor_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 AdGroupsApi.ad_groups_bid_floor_get, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'bid_floor_create' is set
  if @api_client.config.client_side_validation && bid_floor_create.nil?
    fail ArgumentError, "Missing the required parameter 'bid_floor_create' when calling AdGroupsApi.ad_groups_bid_floor_get"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/bid_floor'.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(bid_floor_create)

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

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

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

#ad_groups_create(ad_account_id, ad_group_create_create, opts = {}) ⇒ AdGroupsCreate200Response

Create ad groups Create multiple new ad groups. All ads in a given ad group will have the same budget, bid, run dates, targeting, and placement (search, browse, other). For more information, click here. Notes: - bid_in_micro_currency and budget_in_micro_currency should be expressed in microcurrency amounts based on the currency field set in the advertiser's profile. Microcurrency is used to track very small transactions, based on the currency set in the advertiser's profile. A microcurrency unit is 10^(-6) of the standard unit of currency selected in the advertiser's profile. Equivalency equations, using dollars as an example currency: - $1 = 1,000,000 microdollars - 1 microdollar = $0.000001 To convert between currency and microcurrency, using dollars as an example currency: - To convert dollars to microdollars, multiply dollars by 1,000,000 - To convert microdollars to dollars, divide microdollars by 1,000,000 - Ad groups belong to ad campaigns. Some types of campaigns (e.g. budget optimization) have limits on the number of ad groups they can hold. If you exceed those limits, you will get an error message. - Certain organizations with closed beta access can set start_time and end_time at the ad group level for campaigns with Campaign Budget Optimization (CBO) objectives: TRAFFIC, AWARENESS, WEB_CONVERSIONS, and CATALOG_SALES. All other organizations can set these scheduling parameters for non-CBO campaigns only. - If the parent ad campaign has start and end times set, ad group start and end times must occur within the parent campaign schedule.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:



343
344
345
346
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 343

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

#ad_groups_create_with_http_info(ad_account_id, ad_group_create_create, opts = {}) ⇒ Array<(AdGroupsCreate200Response, Integer, Hash)>

Create ad groups Create multiple new ad groups. All ads in a given ad group will have the same budget, bid, run dates, targeting, and placement (search, browse, other). For more information, click here. Notes: - `bid_in_micro_currency` and `budget_in_micro_currency` should be expressed in microcurrency amounts based on the currency field set in the advertiser's profile. Microcurrency is used to track very small transactions, based on the currency set in the advertiser's profile. A microcurrency unit is 10^(-6) of the standard unit of currency selected in the advertiser's profile. Equivalency equations, using dollars as an example currency: - $1 = 1,000,000 microdollars - 1 microdollar = $0.000001 To convert between currency and microcurrency, using dollars as an example currency: - To convert dollars to microdollars, multiply dollars by 1,000,000 - To convert microdollars to dollars, divide microdollars by 1,000,000 - Ad groups belong to ad campaigns. Some types of campaigns (e.g. budget optimization) have limits on the number of ad groups they can hold. If you exceed those limits, you will get an error message. - Certain organizations with closed beta access can set `start_time` and `end_time` at the ad group level for campaigns with Campaign Budget Optimization (CBO) objectives: `TRAFFIC`, `AWARENESS`, `WEB_CONVERSIONS`, and `CATALOG_SALES`. All other organizations can set these scheduling parameters for non-CBO campaigns only. - If the parent ad campaign has start and end times set, ad group start and end times must occur within the parent campaign schedule.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:

  • AdGroupsCreate200Response data, response status code and response headers



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
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
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 354

def ad_groups_create_with_http_info(, ad_group_create_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_create ...'
  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 AdGroupsApi.ad_groups_create"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_create, 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 AdGroupsApi.ad_groups_create, must conform to the pattern #{pattern}."
  end

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

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups'.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(ad_group_create_create)

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

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

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

#ad_groups_dynamic_titles_download_csv(ad_account_id, ad_group_id, opts = {}) ⇒ DynamicTitlesDownloadCSV

Get dynamic titles CSV download URL Get a presigned S3 download URL for the dynamic titles review CSV. Returns 400 if titles have not been generated yet.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:



434
435
436
437
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 434

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

#ad_groups_dynamic_titles_download_csv_with_http_info(ad_account_id, ad_group_id, opts = {}) ⇒ Array<(DynamicTitlesDownloadCSV, Integer, Hash)>

Get dynamic titles CSV download URL Get a presigned S3 download URL for the dynamic titles review CSV. Returns 400 if titles have not been generated yet.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:

  • DynamicTitlesDownloadCSV data, response status code and response headers



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 445

def ad_groups_dynamic_titles_download_csv_with_http_info(, ad_group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_dynamic_titles_download_csv ...'
  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 AdGroupsApi.ad_groups_dynamic_titles_download_csv"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_dynamic_titles_download_csv, 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 AdGroupsApi.ad_groups_dynamic_titles_download_csv, must conform to the pattern #{pattern}."
  end

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

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/{ad_group_id}/dynamic_titles/csv'.sub('{ad_account_id}', CGI.escape(.to_s)).sub('{ad_group_id}', CGI.escape(ad_group_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) 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] || 'DynamicTitlesDownloadCSV'

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

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

#ad_groups_dynamic_titles_get_status(ad_account_id, ad_group_id, opts = {}) ⇒ DynamicTitlesGetStatus

Get dynamic titles status Get dynamic titles generation status for an ad group, including whether titles are ready for review and counts of generated and reviewed titles.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:



521
522
523
524
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 521

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

#ad_groups_dynamic_titles_get_status_with_http_info(ad_account_id, ad_group_id, opts = {}) ⇒ Array<(DynamicTitlesGetStatus, Integer, Hash)>

Get dynamic titles status Get dynamic titles generation status for an ad group, including whether titles are ready for review and counts of generated and reviewed titles.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:

  • DynamicTitlesGetStatus data, response status code and response headers



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

def ad_groups_dynamic_titles_get_status_with_http_info(, ad_group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_dynamic_titles_get_status ...'
  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 AdGroupsApi.ad_groups_dynamic_titles_get_status"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_dynamic_titles_get_status, 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 AdGroupsApi.ad_groups_dynamic_titles_get_status, must conform to the pattern #{pattern}."
  end

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

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/{ad_group_id}/dynamic_titles/status'.sub('{ad_account_id}', CGI.escape(.to_s)).sub('{ad_group_id}', CGI.escape(ad_group_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) 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] || 'DynamicTitlesGetStatus'

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

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

#ad_groups_dynamic_titles_get_upload_url(ad_account_id, ad_group_id, opts = {}) ⇒ DynamicTitlesUploadURL

Get dynamic titles upload URL Get a presigned S3 upload URL for the dynamic titles review CSV and a request_id for submission.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:



608
609
610
611
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 608

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

#ad_groups_dynamic_titles_get_upload_url_with_http_info(ad_account_id, ad_group_id, opts = {}) ⇒ Array<(DynamicTitlesUploadURL, Integer, Hash)>

Get dynamic titles upload URL Get a presigned S3 upload URL for the dynamic titles review CSV and a request_id for submission.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:

  • DynamicTitlesUploadURL data, response status code and response headers



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
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
685
686
687
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 619

def ad_groups_dynamic_titles_get_upload_url_with_http_info(, ad_group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_dynamic_titles_get_upload_url ...'
  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 AdGroupsApi.ad_groups_dynamic_titles_get_upload_url"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_dynamic_titles_get_upload_url, 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 AdGroupsApi.ad_groups_dynamic_titles_get_upload_url, must conform to the pattern #{pattern}."
  end

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

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/{ad_group_id}/dynamic_titles/uploads'.sub('{ad_account_id}', CGI.escape(.to_s)).sub('{ad_group_id}', CGI.escape(ad_group_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) 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] || 'DynamicTitlesUploadURL'

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

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

#ad_groups_dynamic_titles_process_csv(ad_account_id, ad_group_id, dynamic_titles_process_csv_create, opts = {}) ⇒ DynamicTitlesProcessCSV

Process dynamic titles CSV Validate and process the uploaded dynamic titles review CSV. Returns validation errors if the CSV is invalid.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:



696
697
698
699
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 696

def ad_groups_dynamic_titles_process_csv(, ad_group_id, dynamic_titles_process_csv_create, opts = {})
  data, _status_code, _headers = ad_groups_dynamic_titles_process_csv_with_http_info(, ad_group_id, dynamic_titles_process_csv_create, opts)
  data
end

#ad_groups_dynamic_titles_process_csv_with_http_info(ad_account_id, ad_group_id, dynamic_titles_process_csv_create, opts = {}) ⇒ Array<(DynamicTitlesProcessCSV, Integer, Hash)>

Process dynamic titles CSV Validate and process the uploaded dynamic titles review CSV. Returns validation errors if the CSV is invalid.

Parameters:

  • Unique identifier of an ad account.

  • Ad group ID.

  • (defaults to: {})

    the optional parameters

Returns:

  • DynamicTitlesProcessCSV data, response status code and response headers



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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 708

def ad_groups_dynamic_titles_process_csv_with_http_info(, ad_group_id, dynamic_titles_process_csv_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_dynamic_titles_process_csv ...'
  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 AdGroupsApi.ad_groups_dynamic_titles_process_csv"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_dynamic_titles_process_csv, 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 AdGroupsApi.ad_groups_dynamic_titles_process_csv, must conform to the pattern #{pattern}."
  end

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

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

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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) 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(dynamic_titles_process_csv_create)

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

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

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

#ad_groups_get(ad_group_id, ad_account_id, opts = {}) ⇒ AdGroup

Get ad group Get a specific ad group given the ad group ID.

Parameters:

  • Ad group ID.

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:



793
794
795
796
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 793

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

#ad_groups_get_with_http_info(ad_group_id, ad_account_id, opts = {}) ⇒ Array<(AdGroup, Integer, Hash)>

Get ad group Get a specific ad group given the ad group ID.

Parameters:

  • Ad group ID.

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:

  • AdGroup data, response status code and response headers



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
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 804

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

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && ad_group_id !~ pattern
    fail ArgumentError, "invalid value for 'ad_group_id' when calling AdGroupsApi.ad_groups_get, must conform to the pattern #{pattern}."
  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 AdGroupsApi.ad_groups_get"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/{ad_group_id}'.sub('{ad_group_id}', CGI.escape(ad_group_id.to_s)).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] || 'AdGroup'

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

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

#ad_groups_list(ad_account_id, opts = {}) ⇒ AdGroupsList200Response

List ad groups List ad groups based on provided campaign IDs or ad group IDs.(campaign_ids or ad_group_ids). Note: Provide only campaign_id or ad_group_id. Do not provide both.

Parameters:

  • Unique identifier of an ad account.

  • (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.

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to retrieve keywords from. This feature is currently in BETA and is not available to all users.

  • :entity_statuses (Array<EntityStatus>)

    Entity status

  • :translate_interests_to_names (Boolean)

    Return interests as text names (if value is true) rather than topic IDs. (default to false)

Returns:



886
887
888
889
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 886

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

#ad_groups_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AdGroupsList200Response, Integer, Hash)>

List ad groups List ad groups based on provided campaign IDs or ad group IDs.(campaign_ids or ad_group_ids). Note: Provide only campaign_id or ad_group_id. Do not provide both.

Parameters:

  • Unique identifier of an ad account.

  • (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.

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to retrieve keywords from. This feature is currently in BETA and is not available to all users.

  • :entity_statuses (Array<EntityStatus>)

    Entity status

  • :translate_interests_to_names (Boolean)

    Return interests as text names (if value is true) rather than topic IDs. (default to false)

Returns:

  • AdGroupsList200Response data, response status code and response headers



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
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 903

def ad_groups_list_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_list"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_list, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 250
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdGroupsApi.ad_groups_list, number of items must be less than or equal to 250.'
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdGroupsApi.ad_groups_list, number of items must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length > 250
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdGroupsApi.ad_groups_list, number of items must be less than or equal to 250.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdGroupsApi.ad_groups_list, number of items must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups'.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?
  query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
  query_params[:'ad_group_ids'] = @api_client.build_collection_param(opts[:'ad_group_ids'], :multi) if !opts[:'ad_group_ids'].nil?
  query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
  query_params[:'translate_interests_to_names'] = opts[:'translate_interests_to_names'] if !opts[:'translate_interests_to_names'].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] || 'AdGroupsList200Response'

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

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

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

Get targeting analytics for ad groups Get targeting analytics for one or more ad groups. For the requested ad group(s) 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:

  • Unique identifier of an ad account.

  • List of Ad group Ids to use to filter the results.

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

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

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

  • 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.

  • 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

  • (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.

  • :sort_columns (Array<String>)

    Sort Columns.

  • :sort_ascending (Boolean)

    Sort ascending.

Returns:



1010
1011
1012
1013
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1010

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

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

Get targeting analytics for ad groups Get targeting analytics for one or more ad groups. For the requested ad group(s) 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;). - 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:

  • Unique identifier of an ad account.

  • List of Ad group Ids to use to filter the results.

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

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

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

  • 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.

  • 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

  • (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.

  • :sort_columns (Array<String>)

    Sort Columns.

  • :sort_ascending (Boolean)

    Sort ascending.

Returns:

  • MetricsResponse data, response status code and response headers



1034
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
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
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
1168
1169
1170
1171
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1034

def ad_groups_targeting_analytics_get_with_http_info(, ad_group_ids, start_date, end_date, targeting_types, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_targeting_analytics_get, must conform to the pattern #{pattern}."
  end

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

  if @api_client.config.client_side_validation && ad_group_ids.length < 1
    fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdGroupsApi.ad_groups_targeting_analytics_get, number of items must be greater than or equal to 1.'
  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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_targeting_analytics_get"
  end
  if @api_client.config.client_side_validation && targeting_types.length > 14
    fail ArgumentError, 'invalid value for "targeting_types" when calling AdGroupsApi.ad_groups_targeting_analytics_get, number of items must be less than or equal to 14.'
  end

  if @api_client.config.client_side_validation && targeting_types.length < 1
    fail ArgumentError, 'invalid value for "targeting_types" when calling AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_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 AdGroupsApi.ad_groups_targeting_analytics_get, number of items must be less than or equal to 2.'
  end

  if @api_client.config.client_side_validation && !opts[:'sort_columns'].nil? && opts[:'sort_columns'].length > 2
    fail ArgumentError, 'invalid value for "opts[:"sort_columns"]" when calling AdGroupsApi.ad_groups_targeting_analytics_get, number of items must be less than or equal to 2.'
  end

  if @api_client.config.client_side_validation && !opts[:'sort_columns'].nil? && opts[:'sort_columns'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"sort_columns"]" when calling AdGroupsApi.ad_groups_targeting_analytics_get, number of items must be greater than or equal to 1.'
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi)
  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?
  query_params[:'sort_columns'] = @api_client.build_collection_param(opts[:'sort_columns'], :multi) if !opts[:'sort_columns'].nil?
  query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].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 => :"AdGroupsApi.ad_groups_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: AdGroupsApi#ad_groups_targeting_analytics_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ad_groups_update(ad_account_id, ad_group_update_batch_update, opts = {}) ⇒ AdGroupsCreate200Response

Update ad groups Update multiple existing ad groups.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:



1179
1180
1181
1182
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1179

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

#ad_groups_update_with_http_info(ad_account_id, ad_group_update_batch_update, opts = {}) ⇒ Array<(AdGroupsCreate200Response, Integer, Hash)>

Update ad groups Update multiple existing ad groups.

Parameters:

  • Unique identifier of an ad account.

  • (defaults to: {})

    the optional parameters

Returns:

  • AdGroupsCreate200Response 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
1257
1258
1259
1260
1261
1262
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1190

def ad_groups_update_with_http_info(, ad_group_update_batch_update, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.ad_groups_update ...'
  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 AdGroupsApi.ad_groups_update"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.ad_groups_update, 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 AdGroupsApi.ad_groups_update, must conform to the pattern #{pattern}."
  end

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

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

  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups'.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(ad_group_update_batch_update)

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

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

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

#get_ad_groups_by_promotion_ids_list(ad_account_id, promotion_ids, opts = {}) ⇒ AdGroupsList200Response

List of ad groups using promotions IDs. Get a list of ad groups that are associated with those promotion ids

Parameters:

  • Unique identifier of an ad account.

  • List of Promotion IDs to use to filter the results.

  • (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:



1273
1274
1275
1276
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1273

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

#get_ad_groups_by_promotion_ids_list_with_http_info(ad_account_id, promotion_ids, opts = {}) ⇒ Array<(AdGroupsList200Response, Integer, Hash)>

List of ad groups using promotions IDs. Get a list of ad groups that are associated with those promotion ids

Parameters:

  • Unique identifier of an ad account.

  • List of Promotion IDs to use to filter the results.

  • (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:

  • AdGroupsList200Response data, response status code and response headers



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
# File 'lib/pinterest_sdk/api/ad_groups_api.rb', line 1287

def get_ad_groups_by_promotion_ids_list_with_http_info(, promotion_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdGroupsApi.get_ad_groups_by_promotion_ids_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 AdGroupsApi.get_ad_groups_by_promotion_ids_list"
  end
  if @api_client.config.client_side_validation && .to_s.length > 18
    fail ArgumentError, 'invalid value for "ad_account_id" when calling AdGroupsApi.get_ad_groups_by_promotion_ids_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 AdGroupsApi.get_ad_groups_by_promotion_ids_list, must conform to the pattern #{pattern}."
  end

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

  if @api_client.config.client_side_validation && promotion_ids.length < 1
    fail ArgumentError, 'invalid value for "promotion_ids" when calling AdGroupsApi.get_ad_groups_by_promotion_ids_list, number of items must be greater than or equal to 1.'
  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 AdGroupsApi.get_ad_groups_by_promotion_ids_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 AdGroupsApi.get_ad_groups_by_promotion_ids_list, must be greater than or equal to 1.'
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'promotion_ids'] = @api_client.build_collection_param(promotion_ids, :multi)
  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] || 'AdGroupsList200Response'

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

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