Permalink
Browse files

Added ability to get goals

  • Loading branch information...
Chris Le
Chris Le committed Feb 21, 2011
1 parent 2099e59 commit 0f6d687232a880b8d55be1265b21182b248918ef
Showing with 11 additions and 2 deletions.
  1. +1 −1 lib/gattica.rb
  2. +10 −1 lib/gattica/account.rb
View
@@ -261,7 +261,7 @@ def build_query_string(args,profile)
unless args[:segment].nil?
output += "&segment=#{args[:segment]}"
end
# TODO: update so that in regular expression filters (=~ and !~), any initial special characters in the regular expression aren't also picked up as part of the operator (doesn't cause a problem, but just feels dirty)
unless args[:filters].empty? # filters are a little more complicated because they can have all kinds of modifiers
output += '&filters=' + args[:filters].collect do |filter|
View
@@ -9,7 +9,7 @@ class Account
include Convertible
attr_reader :id, :updated, :title, :table_id, :account_id, :account_name, :profile_id, :web_property_id
attr_reader :id, :updated, :title, :table_id, :account_id, :account_name, :profile_id, :web_property_id, :goals
def initialize(xml)
@id = xml.at(:id).inner_html
@@ -20,6 +20,15 @@ def initialize(xml)
@account_name = xml.at("dxp:property[@name='ga:accountName']").attributes['value']
@profile_id = xml.at("dxp:property[@name='ga:profileId']").attributes['value'].to_i
@web_property_id = xml.at("dxp:property[@name='ga:webPropertyId']").attributes['value']
@goals = xml.search('ga:goal').collect do |goal| {
:active => goal.attributes['active'],
:name => goal.attributes['name'],
:number => goal.attributes['number'].to_i,
:value => goal.attributes['value'].to_f,
}
end
end
end

0 comments on commit 0f6d687

Please sign in to comment.