Skip to content
This repository has been archived by the owner on Apr 4, 2018. It is now read-only.

Commit

Permalink
Consolidate analytics_parameters methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Fliri committed Feb 7, 2013
1 parent d520fd0 commit 596b7ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 10 additions & 1 deletion lib/collectors/config/base.rb
Expand Up @@ -11,7 +11,9 @@ def initialize start_at, end_at
end

def analytics_parameters()
[build_parameters_for]
google_analytics_id_list.map do |id|
build_parameters_for(id: id)
end
end

def build_parameters_for(config = {})
Expand Down Expand Up @@ -44,6 +46,13 @@ def to_s
parameters = analytics_parameters
"#{parameters["metrics"]}, #{parameters["dimensions"]} starting at: #{parameters["start-date"]}"
end

private

def google_analytics_id_list
[*self.class::GOOGLE_ANALYTICS_URL_ID]
end

end
end
end
5 changes: 0 additions & 5 deletions lib/collectors/weekly_content_engagement_transaction.rb
Expand Up @@ -17,11 +17,6 @@ class WeeklyContentEngagementTransaction < Base
FILTERS = "ga:eventCategory==MS_transaction"
RESPONSE_TYPE = GoogleAnalytics::WeeklyContentEngagementResponse

def analytics_parameters()
self.class::GOOGLE_ANALYTICS_URL_ID.map do |id|
build_parameters_for(id: id)
end
end
end
end
end
Expand Up @@ -15,11 +15,6 @@ class WeeklyContentEngagementTransactionDetail < Base
FILTERS= "ga:eventCategory==MS_transaction"
RESPONSE_TYPE = GoogleAnalytics::WeeklyContentEngagementDetailResponse

def analytics_parameters()
self.class::GOOGLE_ANALYTICS_URL_ID.map do |id|
build_parameters_for(id: id)
end
end
end
end
end

0 comments on commit 596b7ee

Please sign in to comment.