From 5659d15a4fa9e139754ea63737d7b6291bc52eb8 Mon Sep 17 00:00:00 2001 From: Todd Eichel Date: Tue, 25 Jul 2017 18:11:30 -0700 Subject: [PATCH] Add ability to pass `bid_amount` parameter when creating ad sets --- lib/facebook_ads/ad_campaign.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/facebook_ads/ad_campaign.rb b/lib/facebook_ads/ad_campaign.rb index 5308073..f376ab6 100644 --- a/lib/facebook_ads/ad_campaign.rb +++ b/lib/facebook_ads/ad_campaign.rb @@ -60,7 +60,7 @@ def ad_sets(effective_status: ['ACTIVE'], limit: 100) AdSet.paginate("/#{id}/adsets", query: { effective_status: effective_status, limit: limit }) end - def create_ad_set(name:, promoted_object:, targeting:, daily_budget:, optimization_goal:, billing_event: 'IMPRESSIONS', status: 'ACTIVE', is_autobid: nil) + def create_ad_set(name:, promoted_object:, targeting:, daily_budget:, optimization_goal:, billing_event: 'IMPRESSIONS', status: 'ACTIVE', is_autobid: nil, bid_amount: nil) raise Exception, "Optimization goal must be one of: #{AdSet::OPTIMIZATION_GOALS.join(', ')}" unless AdSet::OPTIMIZATION_GOALS.include?(optimization_goal) raise Exception, "Billing event must be one of: #{AdSet::BILLING_EVENTS.join(', ')}" unless AdSet::BILLING_EVENTS.include?(billing_event) @@ -80,7 +80,8 @@ def create_ad_set(name:, promoted_object:, targeting:, daily_budget:, optimizati daily_budget: daily_budget, billing_event: billing_event, status: status, - is_autobid: is_autobid + is_autobid: is_autobid, + bid_amount: bid_amount } result = AdSet.post("/act_#{account_id}/adsets", query: query) AdSet.find(result['id'])