The fallowing script is taking getting all the client from a MCC account, 
what I should add in order to get the client children?


    class Account < ActiveRecord::Base
  attr_reader :customer_id, :login, :company_name, :child_accounts
  attr_accessor :parent

def initialize(api_account)
@customer_id = api_account[:customer_id]
@login = api_account[:login]
@company_name = api_account[:company_name]
@child_accounts = []
end
def self.get_accounts_map(graph)
accounts = {}
if graph and graph[:entries]
accounts = graph[:entries].inject({}) do |result, account|
result[account[:customer_id]] = Account.new(account)
result
end
if graph[:links]
graph[:links].each do |link|
parent_account = accounts[link[:manager_customer_id]]
child_account = accounts[link[:client_customer_id]]
child_account.parent = parent_account
parent_account.add_child(child_account) if parent_account
end
end
accounts.reject! {|id, account| !account.parent.nil?}
end
return accounts
end

def add_child(child)
@child_accounts << child
end
    end

Thank you

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to