Sha256: d60eeb44d677f0f7f104582df81be132883d5038e1bf5bcd8493422af73cd5e3

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
adparlor-facebook-0.8.2 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.8.0 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.9 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.8 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.7 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.6 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.5 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.4 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.3 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.2 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.1 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.7.0 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.6.6 lib/adparlor/facebook/graph_api/campaign.rb
adparlor-facebook-0.6.5 lib/adparlor/facebook/graph_api/campaign.rb