Class: MostPopular::Analytics::GoogleAnalytics

Inherits:
Object
  • Object
show all
Defined in:
lib/most-popular/google_analytics.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, api_method, profile_id, filter) ⇒ GoogleAnalytics

Don’t call GoogleAnalytics.new directly. Use GoogleAnalyticsBuilder instead. See unit tests



7
8
9
10
11
12
# File 'lib/most-popular/google_analytics.rb', line 7

def initialize(client, api_method, profile_id, filter)
  @client = client
  @api_method = api_method
  @profile_id = profile_id
  @filter = filter
end

Instance Method Details

#summarize(args = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/most-popular/google_analytics.rb', line 14

def summarize(args={})
  args = defaults.merge(args)
  results = @client.execute(
    :api_method => @api_method,
    :parameters => query_hash(args))
  results.data.rows
end