Module: FbGraph::Connections::AdAccounts

Included in:
User
Defined in:
lib/fb_graph/connections/ad_accounts.rb

Instance Method Summary collapse

Instance Method Details

#ad_account!(options = {}) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fb_graph/connections/ad_accounts.rb', line 13

def ad_account!(options = {})
   = post options.merge(:connection => :adaccounts)

   = [:id]

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

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

  AdAccount.new , merged_attrs
end

#ad_accounts(options = {}) ⇒ Object


4
5
6
7
8
9
10
11
# File 'lib/fb_graph/connections/ad_accounts.rb', line 4

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