module Adparlor module Facebook module GraphApi class Campaign < GraphObject include Fields::Campaign include Traits::Methods field_attrs FIELDS allow_method :create allow_local_method :create, :destroy, :update class << self def destroy(attributes = {}, options = {}) obj = new(attributes.merge(status: 'DELETED')) obj.post(obj.update_path, options, 'DELETE') end end def path raise FbError.new('required parameter account_id missing', 500) unless account_id "/act_#{account_id}/campaigns" end def update_path raise FbError.new('required parameter id missing', 500) unless id "/#{id}" end def delete raise FbError.new('delete not available, use soft delete update', 500) end def ads @ads ||= CollectionProxy.new(Ad, "/#{id}/ads", access_token) end def adsets @adsets ||= CollectionProxy.new(AdSet, "/#{id}/adsets", access_token) end end end end end