Permalink
Browse files

minor account and profile cleanup

  • Loading branch information...
tpitale committed May 7, 2010
1 parent 0446243 commit a0114516ae6e803c357e54bb41e8078981fc3b26
Showing with 5 additions and 12 deletions.
  1. +4 −12 lib/garb/account.rb
  2. +1 −0 lib/garb/profile.rb
View
@@ -9,21 +9,13 @@ def initialize(profiles)
end
def self.all(session = Session)
- # Profile.all.group_to_array{|p| p.account_id}.map{|profiles| new(profiles)}
+ profiles = {}
- profile_groups = Profile.all(session).inject({}) do |hash, profile|
- key = profile.account_id
-
- if hash.has_key?(key)
- hash[key] << profile
- else
- hash[key] = [profile]
- end
-
- hash
+ Profile.all(session).each do |profile|
+ (profiles[profile.account_id] ||= []) << profile
end
- profile_groups.map {|k,v| v}.map {|profiles| new(profiles)}
+ profiles.map {|k,v| v}.map {|profiles| new(profiles)}
end
end
end
View
@@ -23,6 +23,7 @@ def self.all(session = Session)
url = "https://www.google.com/analytics/feeds/accounts/default"
response = DataRequest.new(session, url).send_request
+ puts response.body
parse_entries(parse(response.body)).map {|entry| new(entry, session)}
end

0 comments on commit a011451

Please sign in to comment.