Class: PinterestSdkClient::AdsApi
- Inherits:
-
Object
- Object
- PinterestSdkClient::AdsApi
- Defined in:
- lib/pinterest_sdk/api/ads_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#ad_previews_create(ad_account_id, ad_preview_request, opts = {}) ⇒ AdPreviewURLResponse
Create ad preview with pin or image Create an ad preview given an ad account ID and either an existing organic pin ID or the URL for an image to be used to create the Pin and the ad.
-
#ad_previews_create_with_http_info(ad_account_id, ad_preview_request, opts = {}) ⇒ Array<(AdPreviewURLResponse, Integer, Hash)>
Create ad preview with pin or image Create an ad preview given an ad account ID and either an existing organic pin ID or the URL for an image to be used to create the Pin and the ad.
-
#ad_targeting_analytics_get(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ MetricsResponse
Get targeting analytics for ads Get targeting analytics for one or more ads.
-
#ad_targeting_analytics_get_with_http_info(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ Array<(MetricsResponse, Integer, Hash)>
Get targeting analytics for ads Get targeting analytics for one or more ads.
-
#ads_analytics(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<AdsAnalytics>
Get ad analytics Get analytics for the specified ads in the specified
ad_account_id, filtered by the specified options. -
#ads_analytics_with_http_info(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<(Array<AdsAnalytics>, Integer, Hash)>
Get ad analytics Get analytics for the specified ads in the specified `ad_account_id`, filtered by the specified options.
-
#ads_create(ad_account_id, ad_create, opts = {}) ⇒ AdBatchWriteResponseModel
Create ads Create multiple new ads.
-
#ads_create_with_http_info(ad_account_id, ad_create, opts = {}) ⇒ Array<(AdBatchWriteResponseModel, Integer, Hash)>
Create ads Create multiple new ads.
-
#ads_get(ad_id, ad_account_id, opts = {}) ⇒ Ad
Get ad Get a specific ad given the ad ID.
-
#ads_get_with_http_info(ad_id, ad_account_id, opts = {}) ⇒ Array<(Ad, Integer, Hash)>
Get ad Get a specific ad given the ad ID.
-
#ads_list(ad_account_id, opts = {}) ⇒ AdsList200Response
List ads List ads that meet the filters provided: - Listed campaign ids or ad group ids or ad ids - Listed entity statuses If no filter is provided, all ads in the ad account are returned.
-
#ads_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AdsList200Response, Integer, Hash)>
List ads List ads that meet the filters provided: - Listed campaign ids or ad group ids or ad ids - Listed entity statuses If no filter is provided, all ads in the ad account are returned.
-
#ads_update(ad_account_id, ad_batch_update, opts = {}) ⇒ AdBatchWriteResponseModel
Update ads Update multiple existing ads.
-
#ads_update_with_http_info(ad_account_id, ad_batch_update, opts = {}) ⇒ Array<(AdBatchWriteResponseModel, Integer, Hash)>
Update ads Update multiple existing ads.
-
#campaign_ad_preview_create(ad_account_id, campaign_ad_preview_create, opts = {}) ⇒ Array<CampaignAdPreviewCreate200ResponseInner>
Create ad preview records for one or more ad groups Create ad preview records for one or more ad groups that can be shared.
-
#campaign_ad_preview_create_with_http_info(ad_account_id, campaign_ad_preview_create, opts = {}) ⇒ Array<(Array<CampaignAdPreviewCreate200ResponseInner>, Integer, Hash)>
Create ad preview records for one or more ad groups Create ad preview records for one or more ad groups that can be shared.
-
#campaign_ad_preview_delete(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<CampaignAdPreviewDelete200ResponseInner>
Delete ad preview records for one or more ad groups Delete ad preview records for one or more ad groups.
-
#campaign_ad_preview_delete_with_http_info(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<(Array<CampaignAdPreviewDelete200ResponseInner>, Integer, Hash)>
Delete ad preview records for one or more ad groups Delete ad preview records for one or more ad groups.
-
#campaign_ad_preview_read(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<CampaignAdPreview>
Fetch ad preview records for one or more ad groups Fetch ad preview records for one or more ad groups.
-
#campaign_ad_preview_read_with_http_info(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<(Array<CampaignAdPreview>, Integer, Hash)>
Fetch ad preview records for one or more ad groups Fetch ad preview records for one or more ad groups.
-
#initialize(api_client = ApiClient.default) ⇒ AdsApi
constructor
A new instance of AdsApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#ad_previews_create(ad_account_id, ad_preview_request, opts = {}) ⇒ AdPreviewURLResponse
Create ad preview with pin or image Create an ad preview given an ad account ID and either an existing organic pin ID or the URL for an image to be used to create the Pin and the ad. If you are creating a preview from an existing Pin, that Pin must be promotable: that is, it must have a clickthrough link and meet other requirements. (See Ads Overview.) You can view the returned preview URL on a webpage or iframe for 7 days, after which the URL expires. Collection ads are not currently supported ad preview.
28 29 30 31 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 28 def ad_previews_create(ad_account_id, ad_preview_request, opts = {}) data, _status_code, _headers = ad_previews_create_with_http_info(ad_account_id, ad_preview_request, opts) data end |
#ad_previews_create_with_http_info(ad_account_id, ad_preview_request, opts = {}) ⇒ Array<(AdPreviewURLResponse, Integer, Hash)>
Create ad preview with pin or image Create an ad preview given an ad account ID and either an existing organic pin ID or the URL for an image to be used to create the Pin and the ad. If you are creating a preview from an existing Pin, that Pin must be promotable: that is, it must have a clickthrough link and meet other requirements. (See Ads Overview.) You can view the returned preview URL on a webpage or iframe for 7 days, after which the URL expires. Collection ads are not currently supported ad preview.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 39 def ad_previews_create_with_http_info(ad_account_id, ad_preview_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ad_previews_create ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ad_previews_create" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ad_previews_create, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ad_previews_create, must conform to the pattern #{pattern}." end # verify the required parameter 'ad_preview_request' is set if @api_client.config.client_side_validation && ad_preview_request.nil? fail ArgumentError, "Missing the required parameter 'ad_preview_request' when calling AdsApi.ad_previews_create" end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ad_previews'.sub('{ad_account_id}', CGI.escape(ad_account_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(ad_preview_request) # return_type return_type = opts[:debug_return_type] || 'AdPreviewURLResponse' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.ad_previews_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ad_previews_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ad_targeting_analytics_get(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ MetricsResponse
Get targeting analytics for ads Get targeting analytics for one or more ads. For the requested ad(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.
124 125 126 127 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 124 def ad_targeting_analytics_get(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) data, _status_code, _headers = ad_targeting_analytics_get_with_http_info(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts) data end |
#ad_targeting_analytics_get_with_http_info(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) ⇒ Array<(MetricsResponse, Integer, Hash)>
Get targeting analytics for ads Get targeting analytics for one or more ads. For the requested ad(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.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 148 def ad_targeting_analytics_get_with_http_info(ad_account_id, ad_ids, start_date, end_date, targeting_types, columns, granularity, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ad_targeting_analytics_get ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ad_targeting_analytics_get" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ad_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 && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ad_targeting_analytics_get, must conform to the pattern #{pattern}." end # verify the required parameter 'ad_ids' is set if @api_client.config.client_side_validation && ad_ids.nil? fail ArgumentError, "Missing the required parameter 'ad_ids' when calling AdsApi.ad_targeting_analytics_get" end if @api_client.config.client_side_validation && ad_ids.length > 250 fail ArgumentError, 'invalid value for "ad_ids" when calling AdsApi.ad_targeting_analytics_get, number of items must be less than or equal to 250.' end if @api_client.config.client_side_validation && ad_ids.length < 1 fail ArgumentError, 'invalid value for "ad_ids" when calling AdsApi.ad_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 AdsApi.ad_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 AdsApi.ad_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 AdsApi.ad_targeting_analytics_get" end if @api_client.config.client_side_validation && targeting_types.length > 14 fail ArgumentError, 'invalid value for "targeting_types" when calling AdsApi.ad_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 AdsApi.ad_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 AdsApi.ad_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 AdsApi.ad_targeting_analytics_get" 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 AdsApi.ad_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 AdsApi.ad_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 AdsApi.ad_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}/ads/targeting_analytics'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'ad_ids'] = @api_client.build_collection_param(ad_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'] = opts.merge( :operation => :"AdsApi.ad_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ad_targeting_analytics_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ads_analytics(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<AdsAnalytics>
Get ad analytics
Get analytics for the specified ads 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. - The request must contain either ad_ids or both campaign_ids and pin_ids. - 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.
288 289 290 291 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 288 def ads_analytics(start_date, end_date, columns, granularity, ad_account_id, opts = {}) data, _status_code, _headers = ads_analytics_with_http_info(start_date, end_date, columns, granularity, ad_account_id, opts) data end |
#ads_analytics_with_http_info(start_date, end_date, columns, granularity, ad_account_id, opts = {}) ⇒ Array<(Array<AdsAnalytics>, Integer, Hash)>
Get ad analytics Get analytics for the specified ads 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. - The request must contain either ad_ids or both campaign_ids and pin_ids. - 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.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 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 427 428 429 430 431 432 433 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 310 def ads_analytics_with_http_info(start_date, end_date, columns, granularity, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_analytics" end # verify the required parameter 'columns' is set if @api_client.config.client_side_validation && columns.nil? fail ArgumentError, "Missing the required parameter 'columns' when calling AdsApi.ads_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 AdsApi.ads_analytics" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ads_analytics" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ads_analytics, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ads_analytics, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'pin_ids'].nil? && opts[:'pin_ids'].length > 100 fail ArgumentError, 'invalid value for "opts[:"pin_ids"]" when calling AdsApi.ads_analytics, number of items must be less than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'pin_ids'].nil? && opts[:'pin_ids'].length < 1 fail ArgumentError, 'invalid value for "opts[:"pin_ids"]" when calling AdsApi.ads_analytics, number of items must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length > 250 fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdsApi.ads_analytics, number of items must be less than or equal to 250.' end if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length < 1 fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdsApi.ads_analytics, number of items must be greater than or equal to 1.' 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[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 250 fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdsApi.ads_analytics, 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 AdsApi.ads_analytics, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ads/analytics'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = start_date query_params[:'end_date'] = end_date query_params[:'columns'] = @api_client.build_collection_param(columns, :csv) query_params[:'granularity'] = granularity query_params[:'pin_ids'] = @api_client.build_collection_param(opts[:'pin_ids'], :multi) if !opts[:'pin_ids'].nil? query_params[:'ad_ids'] = @api_client.build_collection_param(opts[:'ad_ids'], :multi) if !opts[:'ad_ids'].nil? 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[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].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<AdsAnalytics>' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials'] = opts.merge( :operation => :"AdsApi.ads_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ads_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ads_create(ad_account_id, ad_create, opts = {}) ⇒ AdBatchWriteResponseModel
Create ads Create multiple new ads. Request must contain ad_group_id, creative_type, and the source Pin pin_id.
441 442 443 444 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 441 def ads_create(ad_account_id, ad_create, opts = {}) data, _status_code, _headers = ads_create_with_http_info(ad_account_id, ad_create, opts) data end |
#ads_create_with_http_info(ad_account_id, ad_create, opts = {}) ⇒ Array<(AdBatchWriteResponseModel, Integer, Hash)>
Create ads Create multiple new ads. Request must contain ad_group_id, creative_type, and the source Pin pin_id.
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 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 452 def ads_create_with_http_info(ad_account_id, ad_create, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ads_create ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ads_create" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ads_create, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ads_create, must conform to the pattern #{pattern}." end # verify the required parameter 'ad_create' is set if @api_client.config.client_side_validation && ad_create.nil? fail ArgumentError, "Missing the required parameter 'ad_create' when calling AdsApi.ads_create" end if @api_client.config.client_side_validation && ad_create.length > 30 fail ArgumentError, 'invalid value for "ad_create" when calling AdsApi.ads_create, number of items must be less than or equal to 30.' end if @api_client.config.client_side_validation && ad_create.length < 1 fail ArgumentError, 'invalid value for "ad_create" when calling AdsApi.ads_create, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ads'.sub('{ad_account_id}', CGI.escape(ad_account_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(ad_create) # return_type return_type = opts[:debug_return_type] || 'AdBatchWriteResponseModel' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.ads_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ads_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ads_get(ad_id, ad_account_id, opts = {}) ⇒ Ad
Get ad Get a specific ad given the ad ID. If your pin is rejected, rejected_reasons will contain additional information from the Ad Review process. For more information about our policies and rejection reasons see the Pinterest advertising standards.
532 533 534 535 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 532 def ads_get(ad_id, ad_account_id, opts = {}) data, _status_code, _headers = ads_get_with_http_info(ad_id, ad_account_id, opts) data end |
#ads_get_with_http_info(ad_id, ad_account_id, opts = {}) ⇒ Array<(Ad, Integer, Hash)>
Get ad Get a specific ad given the ad ID. If your pin is rejected, rejected_reasons will contain additional information from the Ad Review process. For more information about our policies and rejection reasons see the Pinterest advertising standards.
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 543 def ads_get_with_http_info(ad_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ads_get ...' end # verify the required parameter 'ad_id' is set if @api_client.config.client_side_validation && ad_id.nil? fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.ads_get" end if @api_client.config.client_side_validation && ad_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_id" when calling AdsApi.ads_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_id !~ pattern fail ArgumentError, "invalid value for 'ad_id' when calling AdsApi.ads_get, must conform to the pattern #{pattern}." end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ads_get" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ads_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_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ads_get, must conform to the pattern #{pattern}." end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ads/{ad_id}'.sub('{ad_id}', CGI.escape(ad_id.to_s)).sub('{ad_account_id}', CGI.escape(ad_account_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] || 'Ad' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials'] = opts.merge( :operation => :"AdsApi.ads_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ads_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ads_list(ad_account_id, opts = {}) ⇒ AdsList200Response
List ads
List ads that meet the filters provided: - Listed campaign ids or ad group ids or ad ids - Listed entity statuses If no filter is provided, all ads in the ad account are returned. Note: Provide only campaign_id or ad_group_id or ad_id. Do not provide more than one type. Review status is provided for each ad; if review_status is REJECTED, the rejected_reasons field will contain additional information. For more, see Pinterest advertising standards.
625 626 627 628 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 625 def ads_list(ad_account_id, opts = {}) data, _status_code, _headers = ads_list_with_http_info(ad_account_id, opts) data end |
#ads_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AdsList200Response, Integer, Hash)>
List ads List ads that meet the filters provided: - Listed campaign ids or ad group ids or ad ids - Listed entity statuses If no filter is provided, all ads in the ad account are returned. Note: Provide only `campaign_id` or `ad_group_id` or `ad_id`. Do not provide more than one type. Review status is provided for each ad; if `review_status` is `REJECTED`, the `rejected_reasons` field will contain additional information. For more, see Pinterest advertising standards.
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 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 642 def ads_list_with_http_info(ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ads_list ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ads_list" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ads_list, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_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 AdsApi.ads_list, number of items must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length > 250 fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdsApi.ads_list, number of items must be less than or equal to 250.' end if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length < 1 fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdsApi.ads_list, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ads'.sub('{ad_account_id}', CGI.escape(ad_account_id.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[:'ad_ids'] = @api_client.build_collection_param(opts[:'ad_ids'], :multi) if !opts[:'ad_ids'].nil? query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].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] || 'AdsList200Response' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials'] = opts.merge( :operation => :"AdsApi.ads_list", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ads_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#ads_update(ad_account_id, ad_batch_update, opts = {}) ⇒ AdBatchWriteResponseModel
Update ads Update multiple existing ads
744 745 746 747 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 744 def ads_update(ad_account_id, ad_batch_update, opts = {}) data, _status_code, _headers = ads_update_with_http_info(ad_account_id, ad_batch_update, opts) data end |
#ads_update_with_http_info(ad_account_id, ad_batch_update, opts = {}) ⇒ Array<(AdBatchWriteResponseModel, Integer, Hash)>
Update ads Update multiple existing ads
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 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 755 def ads_update_with_http_info(ad_account_id, ad_batch_update, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.ads_update ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.ads_update" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.ads_update, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.ads_update, must conform to the pattern #{pattern}." end # verify the required parameter 'ad_batch_update' is set if @api_client.config.client_side_validation && ad_batch_update.nil? fail ArgumentError, "Missing the required parameter 'ad_batch_update' when calling AdsApi.ads_update" end if @api_client.config.client_side_validation && ad_batch_update.length > 30 fail ArgumentError, 'invalid value for "ad_batch_update" when calling AdsApi.ads_update, number of items must be less than or equal to 30.' end if @api_client.config.client_side_validation && ad_batch_update.length < 1 fail ArgumentError, 'invalid value for "ad_batch_update" when calling AdsApi.ads_update, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/ad_accounts/{ad_account_id}/ads'.sub('{ad_account_id}', CGI.escape(ad_account_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(ad_batch_update) # return_type return_type = opts[:debug_return_type] || 'AdBatchWriteResponseModel' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.ads_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#ads_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#campaign_ad_preview_create(ad_account_id, campaign_ad_preview_create, opts = {}) ⇒ Array<CampaignAdPreviewCreate200ResponseInner>
Create ad preview records for one or more ad groups Create ad preview records for one or more ad groups that can be shared. Each ad group is processed independently; individual failures do not block other previews.
835 836 837 838 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 835 def campaign_ad_preview_create(ad_account_id, campaign_ad_preview_create, opts = {}) data, _status_code, _headers = campaign_ad_preview_create_with_http_info(ad_account_id, campaign_ad_preview_create, opts) data end |
#campaign_ad_preview_create_with_http_info(ad_account_id, campaign_ad_preview_create, opts = {}) ⇒ Array<(Array<CampaignAdPreviewCreate200ResponseInner>, Integer, Hash)>
Create ad preview records for one or more ad groups Create ad preview records for one or more ad groups that can be shared. Each ad group is processed independently; individual failures do not block other previews.
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 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 846 def campaign_ad_preview_create_with_http_info(ad_account_id, campaign_ad_preview_create, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.campaign_ad_preview_create ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.campaign_ad_preview_create" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.campaign_ad_preview_create, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.campaign_ad_preview_create, must conform to the pattern #{pattern}." end # verify the required parameter 'campaign_ad_preview_create' is set if @api_client.config.client_side_validation && campaign_ad_preview_create.nil? fail ArgumentError, "Missing the required parameter 'campaign_ad_preview_create' when calling AdsApi.campaign_ad_preview_create" end # resource path local_var_path = '/ad_accounts/{ad_account_id}/campaign_ad_preview'.sub('{ad_account_id}', CGI.escape(ad_account_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(campaign_ad_preview_create) # return_type return_type = opts[:debug_return_type] || 'Array<CampaignAdPreviewCreate200ResponseInner>' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.campaign_ad_preview_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#campaign_ad_preview_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#campaign_ad_preview_delete(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<CampaignAdPreviewDelete200ResponseInner>
Delete ad preview records for one or more ad groups Delete ad preview records for one or more ad groups. All ad groups are validated before deleting any records.
918 919 920 921 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 918 def campaign_ad_preview_delete(ad_group_ids, ad_account_id, opts = {}) data, _status_code, _headers = campaign_ad_preview_delete_with_http_info(ad_group_ids, ad_account_id, opts) data end |
#campaign_ad_preview_delete_with_http_info(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<(Array<CampaignAdPreviewDelete200ResponseInner>, Integer, Hash)>
Delete ad preview records for one or more ad groups Delete ad preview records for one or more ad groups. All ad groups are validated before deleting any records.
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 990 991 992 993 994 995 996 997 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 929 def campaign_ad_preview_delete_with_http_info(ad_group_ids, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.campaign_ad_preview_delete ...' 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 AdsApi.campaign_ad_preview_delete" end if @api_client.config.client_side_validation && ad_group_ids.length > 250 fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdsApi.campaign_ad_preview_delete, 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 AdsApi.campaign_ad_preview_delete, number of items must be greater than or equal to 1.' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.campaign_ad_preview_delete" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.campaign_ad_preview_delete, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.campaign_ad_preview_delete, must conform to the pattern #{pattern}." end # resource path local_var_path = '/ad_accounts/{ad_account_id}/campaign_ad_preview'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi) # 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<CampaignAdPreviewDelete200ResponseInner>' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.campaign_ad_preview_delete", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#campaign_ad_preview_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#campaign_ad_preview_read(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<CampaignAdPreview>
Fetch ad preview records for one or more ad groups Fetch ad preview records for one or more ad groups. Returns all active previews associated with the provided ad group IDs.
1005 1006 1007 1008 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 1005 def campaign_ad_preview_read(ad_group_ids, ad_account_id, opts = {}) data, _status_code, _headers = campaign_ad_preview_read_with_http_info(ad_group_ids, ad_account_id, opts) data end |
#campaign_ad_preview_read_with_http_info(ad_group_ids, ad_account_id, opts = {}) ⇒ Array<(Array<CampaignAdPreview>, Integer, Hash)>
Fetch ad preview records for one or more ad groups Fetch ad preview records for one or more ad groups. Returns all active previews associated with the provided ad group IDs.
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 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 |
# File 'lib/pinterest_sdk/api/ads_api.rb', line 1016 def campaign_ad_preview_read_with_http_info(ad_group_ids, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.campaign_ad_preview_read ...' 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 AdsApi.campaign_ad_preview_read" end if @api_client.config.client_side_validation && ad_group_ids.length > 250 fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdsApi.campaign_ad_preview_read, 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 AdsApi.campaign_ad_preview_read, number of items must be greater than or equal to 1.' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.campaign_ad_preview_read" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AdsApi.campaign_ad_preview_read, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AdsApi.campaign_ad_preview_read, must conform to the pattern #{pattern}." end # resource path local_var_path = '/ad_accounts/{ad_account_id}/campaign_ad_preview'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi) # 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<CampaignAdPreview>' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"AdsApi.campaign_ad_preview_read", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#campaign_ad_preview_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |