Method: Adapi::Campaign#budget=

Defined in:
lib/adapi/campaign.rb

#budget=(params = {}) ⇒ Object

setter for converting budget to GoogleApi budget can be integer (amount) or hash

TODO return error for missing :amount



90
91
92
93
94
95
96
97
98
99
# File 'lib/adapi/campaign.rb', line 90

def budget=(params = {})
  # if it's single value, it's a budget amount
  params = { amount: params } unless params.is_a?(Hash)

  if params[:amount] and not params[:amount].is_a?(Hash)
    params[:amount] = { micro_amount: Api.to_micro_units(params[:amount]) }
  end

  @budget = params.clone
end