class Outbrain::Api::Budget

Constants

PATH

Public Class Methods

create(attributes) click to toggle source
# File lib/outbrain/api/budget.rb, line 10
def self.create(attributes)
  Request.create(path(attributes.delete(:marketer_id)), {as: self, attributes: attributes})
end
find(budget_id) click to toggle source
# File lib/outbrain/api/budget.rb, line 14
def self.find(budget_id)
  Request.find(PATH, budget_id, { as: self })
end
find_by(attributes={}) click to toggle source
# File lib/outbrain/api/budget.rb, line 18
def self.find_by(attributes={})
  marketer_id = attributes[:marketer_id]
  fail InvalidOption 'find_by requires marketer-id' unless marketer_id
  Request.all(path(marketer_id), { as: self, resource_name: 'budgets'})
end
path(id) click to toggle source
# File lib/outbrain/api/budget.rb, line 6
def self.path(id)
  "marketers/#{id}/budgets"
end
update(budget_id, attributes) click to toggle source
# File lib/outbrain/api/budget.rb, line 28
def self.update(budget_id, attributes)
  Request.update(PATH, budget_id, {as: self, attributes: attributes })
end

Public Instance Methods

create_campaign(attributes) click to toggle source
# File lib/outbrain/api/budget.rb, line 24
def create_campaign(attributes)
  Campaign.create(attributes.merge(budgetId: id))
end