Skip to content

Commit

Permalink
Change ad set is_autobid parameter default to nil (was true)
Browse files Browse the repository at this point in the history
This is a breaking change for current users of this library, but I think it's essential for moving forward. Rationale:

- The previous behavior (defaulting to true) is not aligned with how
  the official FB SDK works, which is not opinionated about default
  parameter values. We shouldn't be opinionated this way either.

- In the future we want to support the `bid_amount` parameter. However
  with `is_autobid` defaulting to true, if someone were to pass
  `bid_amount` without explicitly turning off autobid, the request
  would fail. That seems like an obvious developer trap that we can
  avoid by making users be explicit about autobid when they want it.

Normally a breaking change like this would require a major version
number increment, but since we're on major version 0 the public API is
not expected to be stable, so I plan to just bump the minor version
number.
  • Loading branch information
tfe committed Jul 26, 2017
1 parent 74057d5 commit 4e10b54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/facebook_ads/ad_campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: true)
def create_ad_set(name:, promoted_object:, targeting:, daily_budget:, optimization_goal:, billing_event: 'IMPRESSIONS', status: 'ACTIVE', is_autobid: 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)

Expand Down

0 comments on commit 4e10b54

Please sign in to comment.