Sha256: 6f0371611d837c9e47535b4131842d825edde79c7464241a5c0b37eb94e4a8c5

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

module FbGraph
  module Connections
    module AdAccounts
      def ad_accounts(options = {})
        ad_accounts = self.connection :adaccounts, options
        ad_accounts.map! do |ad_account|
          AdAccount.new ad_account[:id], ad_account.merge(
            :access_token => options[:access_token] || self.access_token
          )
        end
      end
      
      def ad_account!(options = {})
        ad_account = post options.merge(:connection => :adaccounts)

        ad_account_id = ad_account[:id]

        merged_attrs = options.merge(
          :access_token => options[:access_token] || self.access_token
        )

        if options[:redownload]
          merged_attrs = merged_attrs.merge(ad_account[:data][:adaccounts][ad_account_id]).with_indifferent_access
        end

        AdAccount.new ad_account_id, merged_attrs
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fb_graph-2.7.17 lib/fb_graph/connections/ad_accounts.rb
fb_graph-2.7.16 lib/fb_graph/connections/ad_accounts.rb