Class: Zernio::AdCampaignsApi
- Inherits:
-
Object
- Object
- Zernio::AdCampaignsApi
- Defined in:
- lib/zernio-sdk/api/ad_campaigns_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) ⇒ BulkUpdateAdCampaignStatus200Response
Pause or resume many campaigns Process up to 50 campaigns in one call.
-
#bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) ⇒ Array<(BulkUpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume many campaigns Process up to 50 campaigns in one call.
-
#delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ DeleteAdCampaign200Response
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads.
-
#delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ Array<(DeleteAdCampaign200Response, Integer, Hash)>
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads.
-
#duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ DuplicateAdCampaign200Response
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (
deepCopy: true). -
#duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ Array<(DuplicateAdCampaign200Response, Integer, Hash)>
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (`deepCopy: true`).
-
#get_ad_tree(opts = {}) ⇒ GetAdTree200Response
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level.
-
#get_ad_tree_with_http_info(opts = {}) ⇒ Array<(GetAdTree200Response, Integer, Hash)>
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level.
-
#get_ads_timeline(account_id, opts = {}) ⇒ GetAdsTimeline200Response
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range.
-
#get_ads_timeline_with_http_info(account_id, opts = {}) ⇒ Array<(GetAdsTimeline200Response, Integer, Hash)>
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range.
-
#initialize(api_client = ApiClient.default) ⇒ AdCampaignsApi
constructor
A new instance of AdCampaignsApi.
-
#list_ad_campaigns(opts = {}) ⇒ ListAdCampaigns200Response
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID.
-
#list_ad_campaigns_with_http_info(opts = {}) ⇒ Array<(ListAdCampaigns200Response, Integer, Hash)>
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID.
-
#update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) ⇒ UpdateAdCampaign200Response
Update a campaign Campaign-level edits.
-
#update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdCampaignStatus200Response
Pause or resume a campaign Updates the status of all ads in a campaign.
-
#update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume a campaign Updates the status of all ads in a campaign.
-
#update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) ⇒ Array<(UpdateAdCampaign200Response, Integer, Hash)>
Update a campaign Campaign-level edits.
-
#update_ad_set(ad_set_id, update_ad_set_request, opts = {}) ⇒ UpdateAdSet200Response
Update an ad set Ad-set-level writes.
-
#update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdSetStatus200Response
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets).
-
#update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdSetStatus200Response, Integer, Hash)>
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets).
-
#update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) ⇒ Array<(UpdateAdSet200Response, Integer, Hash)>
Update an ad set Ad-set-level writes.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AdCampaignsApi
Returns a new instance of AdCampaignsApi.
19 20 21 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) ⇒ BulkUpdateAdCampaignStatus200Response
Pause or resume many campaigns Process up to 50 campaigns in one call. Each campaign is updated concurrently and the response contains a per-campaign result so a single bad row does not fail the whole batch.
27 28 29 30 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 27 def bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts) data end |
#bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) ⇒ Array<(BulkUpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume many campaigns Process up to 50 campaigns in one call. Each campaign is updated concurrently and the response contains a per-campaign result so a single bad row does not fail the whole batch.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 37 def bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.bulk_update_ad_campaign_status ...' end # verify the required parameter 'bulk_update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && bulk_update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'bulk_update_ad_campaign_status_request' when calling AdCampaignsApi.bulk_update_ad_campaign_status" end # resource path local_var_path = '/v1/ads/campaigns/bulk-status' # 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(bulk_update_ad_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'BulkUpdateAdCampaignStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.bulk_update_ad_campaign_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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#bulk_update_ad_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ DeleteAdCampaign200Response
Delete a campaign
Deletes the whole campaign on the platform, cascading to its ad sets and ads. Locally, all Ad documents for this campaign are marked status: cancelled. Meta-only for now. Other platforms return 501 Not Implemented — fall back to DELETE /v1/ads/adId per ad in the meantime.
96 97 98 99 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 96 def delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) data, _status_code, _headers = delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts) data end |
#delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ Array<(DeleteAdCampaign200Response, Integer, Hash)>
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads. Locally, all Ad documents for this campaign are marked `status: cancelled`. Meta-only for now. Other platforms return 501 Not Implemented — fall back to DELETE /v1/ads/adId per ad in the meantime.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 107 def delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.delete_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.delete_ad_campaign" end # verify the required parameter 'delete_ad_campaign_request' is set if @api_client.config.client_side_validation && delete_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'delete_ad_campaign_request' when calling AdCampaignsApi.delete_ad_campaign" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(delete_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'DeleteAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.delete_ad_campaign", :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: AdCampaignsApi#delete_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ DuplicateAdCampaign200Response
Duplicate a campaign
Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (deepCopy: true). The copy is created paused so callers can review before launching. Per-platform implementation: - Meta uses the native POST /{campaign-id}/copies endpoint. - TikTok has no native copy primitive; Zernio walks the source graph (/v2/campaign/get/, /v2/adgroup/get/, /v2/ad/get/) and recreates each entity via the corresponding /create/ endpoints, carrying over budget / targeting / bid_type / bid_price / deep_bid_type / creative fields. Spark Ad linkage (tiktok_item_id) is preserved. - LinkedIn has no native copy primitive; Zernio walks the source CampaignGroup → Campaigns → Creatives and recreates each entity, carrying over type / costType / unitCost / optimizationTargetType / creativeSelection / objectiveType / format / dailyBudget / totalBudget / targetingCriteria / runSchedule and every Creative's content object verbatim. statusOption: INHERITED_FROM_SOURCE is evaluated per entity: any Group / Campaign / Creative whose source is ACTIVE gets its clone activated too. Duplicating an ACTIVE campaign with INHERITED_FROM_SOURCE starts a second front of spend the moment the clone activates — the safe default is PAUSED. The new hierarchy is asynchronous to materialize in our DB — we trigger sync discovery automatically. Set syncAfter: false to skip and poll /v1/ads/tree on your own cadence. Other platforms return 501 Not Implemented.
170 171 172 173 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 170 def duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) data, _status_code, _headers = duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts) data end |
#duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ Array<(DuplicateAdCampaign200Response, Integer, Hash)>
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (`deepCopy: true`). The copy is created paused so callers can review before launching. Per-platform implementation: - Meta uses the native `POST /campaign-id/copies` endpoint. - TikTok has no native copy primitive; Zernio walks the source graph (`/v2/campaign/get/`, `/v2/adgroup/get/`, `/v2/ad/get/`) and recreates each entity via the corresponding `/create/` endpoints, carrying over budget / targeting / bid_type / bid_price / deep_bid_type / creative fields. Spark Ad linkage (`tiktok_item_id`) is preserved. - LinkedIn has no native copy primitive; Zernio walks the source CampaignGroup → Campaigns → Creatives and recreates each entity, carrying over `type` / `costType` / `unitCost` / `optimizationTargetType` / `creativeSelection` / `objectiveType` / `format` / `dailyBudget` / `totalBudget` / `targetingCriteria` / `runSchedule` and every Creative's `content` object verbatim. `statusOption: INHERITED_FROM_SOURCE` is evaluated per entity: any Group / Campaign / Creative whose source is `ACTIVE` gets its clone activated too. Duplicating an ACTIVE campaign with `INHERITED_FROM_SOURCE` starts a second front of spend the moment the clone activates — the safe default is `PAUSED`. The new hierarchy is asynchronous to materialize in our DB — we trigger sync discovery automatically. Set `syncAfter: false` to skip and poll `/v1/ads/tree` on your own cadence. Other platforms return 501 Not Implemented.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 181 def duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.duplicate_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.duplicate_ad_campaign" end # verify the required parameter 'duplicate_ad_campaign_request' is set if @api_client.config.client_side_validation && duplicate_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'duplicate_ad_campaign_request' when calling AdCampaignsApi.duplicate_ad_campaign" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/duplicate'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(duplicate_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'DuplicateAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.duplicate_ad_campaign", :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: AdCampaignsApi#duplicate_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_tree(opts = {}) ⇒ GetAdTree200Response
Get campaign tree
Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass timeIncrement=1 to also get a daily breakdown: each node gains a daily[] array of per-day metrics (same fields as the aggregated metrics) in the same call. Use dailyLevel (campaign default, or adset / ad) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
256 257 258 259 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 256 def get_ad_tree(opts = {}) data, _status_code, _headers = get_ad_tree_with_http_info(opts) data end |
#get_ad_tree_with_http_info(opts = {}) ⇒ Array<(GetAdTree200Response, Integer, Hash)>
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.
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 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 279 def get_ad_tree_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ad_tree ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.get_ad_tree, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.get_ad_tree, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.get_ad_tree, must be greater than or equal to 1.' end allowable_values = ["zernio", "all"] if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source']) fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end allowable_values = ["newest", "oldest", "spend_desc", "spend_asc"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end allowable_values = [1] if @api_client.config.client_side_validation && opts[:'time_increment'] && !allowable_values.include?(opts[:'time_increment']) fail ArgumentError, "invalid value for \"time_increment\", must be one of #{allowable_values}" end allowable_values = ["campaign", "adset", "ad"] if @api_client.config.client_side_validation && opts[:'daily_level'] && !allowable_values.include?(opts[:'daily_level']) fail ArgumentError, "invalid value for \"daily_level\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/tree' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'timeIncrement'] = opts[:'time_increment'] if !opts[:'time_increment'].nil? query_params[:'dailyLevel'] = opts[:'daily_level'] if !opts[:'daily_level'].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] || 'GetAdTree200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ad_tree", :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: AdCampaignsApi#get_ad_tree\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ads_timeline(account_id, opts = {}) ⇒ GetAdsTimeline200Response
Get daily account metrics
Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range. Use this for dashboards that draw a daily-spend or daily-conversions chart, instead of calling /v1/ads/tree once per day. accountId is required. The lookup is sibling-expanded so passing the metaads ID also includes ads under the linked facebook / instagram posting account (and vice-versa) — same convention as /v1/ads/tree and /v1/ads. Date range defaults to the last 90 days. Capped at 730 days. Ranges older than the ingested history return a 202 immediately with the covered part and backfillPending: true while the rest is backfilled in the background; repeat the request shortly until it returns 200 with full data.
378 379 380 381 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 378 def get_ads_timeline(account_id, opts = {}) data, _status_code, _headers = get_ads_timeline_with_http_info(account_id, opts) data end |
#get_ads_timeline_with_http_info(account_id, opts = {}) ⇒ Array<(GetAdsTimeline200Response, Integer, Hash)>
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range. Use this for dashboards that draw a daily-spend or daily-conversions chart, instead of calling `/v1/ads/tree` once per day. `accountId` is required. The lookup is sibling-expanded so passing the `metaads` ID also includes ads under the linked `facebook` / `instagram` posting account (and vice-versa) — same convention as `/v1/ads/tree` and `/v1/ads`. Date range defaults to the last 90 days. Capped at 730 days. Ranges older than the ingested history return a `202` immediately with the covered part and `backfillPending: true` while the rest is backfilled in the background; repeat the request shortly until it returns 200 with full data.
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 392 def get_ads_timeline_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ads_timeline ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCampaignsApi.get_ads_timeline" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/timeline' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].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] || 'GetAdsTimeline200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ads_timeline", :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: AdCampaignsApi#get_ads_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_campaigns(opts = {}) ⇒ ListAdCampaigns200Response
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
463 464 465 466 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 463 def list_ad_campaigns(opts = {}) data, _status_code, _headers = list_ad_campaigns_with_http_info(opts) data end |
#list_ad_campaigns_with_http_info(opts = {}) ⇒ Array<(ListAdCampaigns200Response, Integer, Hash)>
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
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 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 482 def list_ad_campaigns_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_campaigns ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_campaigns, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.' end allowable_values = ["zernio", "all"] if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source']) fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/campaigns' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].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] || 'ListAdCampaigns200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ad_campaigns", :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: AdCampaignsApi#list_ad_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) ⇒ UpdateAdCampaign200Response
Update a campaign
Campaign-level edits. At least one of budget, bidStrategy, name or platformSpecificData is required. - budget updates the CBO (Campaign Budget Optimization) budget. For ABO campaigns (where the budget lives on the ad set), use PUT /v1/ads/ad-sets/adSetId instead — this endpoint will return 409 with code BUDGET_LEVEL_MISMATCH. - bidStrategy sets the campaign-level default bid strategy. Per Meta's spec, bid_amount and bid_constraints do NOT exist at the campaign level — pass them via PUT /v1/ads/ad-sets/adSetId. - platformSpecificData.spendCap (Meta only) sets the campaign's lifetime spend cap, in the ad account's currency. Meta-only for now. Other platforms return 501 Not Implemented.
562 563 564 565 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 562 def update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) data, _status_code, _headers = update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts) data end |
#update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdCampaignStatus200Response
Pause or resume a campaign Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
636 637 638 639 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 636 def update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts) data end |
#update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume a campaign Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 647 def update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_campaign_status ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_ad_campaign_status" end # verify the required parameter 'update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_status_request' when calling AdCampaignsApi.update_ad_campaign_status" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/status'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(update_ad_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdCampaignStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_campaign_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) ⇒ Array<(UpdateAdCampaign200Response, Integer, Hash)>
Update a campaign Campaign-level edits. At least one of `budget`, `bidStrategy`, `name` or `platformSpecificData` is required. - `budget` updates the CBO (Campaign Budget Optimization) budget. For ABO campaigns (where the budget lives on the ad set), use PUT /v1/ads/ad-sets/adSetId instead — this endpoint will return 409 with code BUDGET_LEVEL_MISMATCH. - `bidStrategy` sets the campaign-level default bid strategy. Per Meta's spec, `bid_amount` and `bid_constraints` do NOT exist at the campaign level — pass them via PUT /v1/ads/ad-sets/adSetId. - `platformSpecificData.spendCap` (Meta only) sets the campaign's lifetime spend cap, in the ad account's currency. Meta-only for now. Other platforms return 501 Not Implemented.
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 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 573 def update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_ad_campaign" end # verify the required parameter 'update_ad_campaign_request' is set if @api_client.config.client_side_validation && update_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_request' when calling AdCampaignsApi.update_ad_campaign" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(update_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_campaign", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_set(ad_set_id, update_ad_set_request, opts = {}) ⇒ UpdateAdSet200Response
Update an ad set
Ad-set-level writes. Use this for ABO budget updates, ad-set-scoped pause/resume, bid-strategy edits, and Meta-only post-launch delivery settings via platformSpecificData. At least one updatable field is required. Bid strategy compatibility (per Meta's spec): - LOWEST_COST_WITHOUT_CAP: no bidAmount, no roasAverageFloor. - LOWEST_COST_WITH_BID_CAP / COST_CAP: bidAmount REQUIRED (whole currency units). - LOWEST_COST_WITH_MIN_ROAS: roasAverageFloor REQUIRED (decimal multiplier, e.g. 2.0 = 2.0x ROAS). Delivery settings are validated by Meta against the campaign objective; incompatible combinations (e.g. a billingEvent the optimization goal doesn't allow) surface as 400s from Meta. When updating budget on an ABO campaign: if the parent campaign is CBO, the response is 409 with code BUDGET_LEVEL_MISMATCH — route to PUT /v1/ads/campaigns/campaignId instead.
710 711 712 713 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 710 def update_ad_set(ad_set_id, update_ad_set_request, opts = {}) data, _status_code, _headers = update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts) data end |
#update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdSetStatus200Response
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets). Thin wrapper over PUT /v1/ads/ad-sets/adSetId for callers that only want the status toggle and prefer a symmetric URL to /v1/ads/campaigns/campaignId/status.
784 785 786 787 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 784 def update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts) data end |
#update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdSetStatus200Response, Integer, Hash)>
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets). Thin wrapper over PUT /v1/ads/ad-sets/adSetId for callers that only want the status toggle and prefer a symmetric URL to /v1/ads/campaigns/campaignId/status.
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 795 def update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_set_status ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.update_ad_set_status" end # verify the required parameter 'update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_status_request' when calling AdCampaignsApi.update_ad_set_status" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/status'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_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(update_ad_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdSetStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_set_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_set_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) ⇒ Array<(UpdateAdSet200Response, Integer, Hash)>
Update an ad set Ad-set-level writes. Use this for ABO budget updates, ad-set-scoped pause/resume, bid-strategy edits, and Meta-only post-launch delivery settings via `platformSpecificData`. At least one updatable field is required. Bid strategy compatibility (per Meta's spec): - `LOWEST_COST_WITHOUT_CAP`: no `bidAmount`, no `roasAverageFloor`. - `LOWEST_COST_WITH_BID_CAP` / `COST_CAP`: `bidAmount` REQUIRED (whole currency units). - `LOWEST_COST_WITH_MIN_ROAS`: `roasAverageFloor` REQUIRED (decimal multiplier, e.g. 2.0 = 2.0x ROAS). Delivery settings are validated by Meta against the campaign objective; incompatible combinations (e.g. a billingEvent the optimization goal doesn't allow) surface as 400s from Meta. When updating `budget` on an ABO campaign: if the parent campaign is CBO, the response is 409 with code BUDGET_LEVEL_MISMATCH — route to PUT /v1/ads/campaigns/campaignId instead.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 721 def update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_set ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.update_ad_set" end # verify the required parameter 'update_ad_set_request' is set if @api_client.config.client_side_validation && update_ad_set_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_set_request' when calling AdCampaignsApi.update_ad_set" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_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(update_ad_set_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdSet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_set", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_set\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |