Sha256: 327e7a31c08f4c1c133dfdd61f099536baf35504f97c6a0e87fab23b66bc951a

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

module FbGraph
  module Connections
    module AdGroups
      def ad_groups(options = {})
        ad_groups = self.connection :adgroups, options
        ad_groups.map! do |ad_group|
          AdGroup.new ad_group[:id], ad_group.merge(
            :access_token => options[:access_token] || self.access_token
          )
        end
      end

      # Note: AdGroups can only be created via the AdAccount connection. Even though it makes sense, they
      # cannot be created via the AdCampaign connection
      def ad_group!(options = {})
        ad_group = post options.merge(:connection => :adgroups)
        AdGroup.new ad_group[:id], options.merge(ad_group).merge(
          :access_token => options[:access_token] || self.access_token,
          :ad_id => ad_group[:id].to_i,
          :adgroup_id => ad_group[:id].to_i
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-2.4.0 lib/fb_graph/connections/ad_groups.rb
fb_graph-2.3.2 lib/fb_graph/connections/ad_groups.rb
fb_graph-2.3.1 lib/fb_graph/connections/ad_groups.rb
fb_graph-2.3.0 lib/fb_graph/connections/ad_groups.rb