Class: Garb::Report

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/garb/report.rb

Constant Summary collapse

MONTH =
2592000
URL =
"https://www.google.com/analytics/feeds/data"

Instance Method Summary collapse

Methods included from Resource

#clear_filters, #default_params, extended, #filters, #format_time, #page_params, #params, #send_request_for_body

Constructor Details

#initialize(profile, opts = {}) ⇒ Report

Returns a new instance of Report.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/garb/report.rb', line 8

def initialize(profile, opts={})
  @profile = profile

  @start_date = opts.fetch(:start_date, Time.now - MONTH)
  @end_date = opts.fetch(:end_date, Time.now)
  @limit = opts.fetch(:limit, nil)
  @offset = opts.fetch(:offset, nil)

  metrics opts.fetch(:metrics, [])
  dimensions opts.fetch(:dimensions, [])
  sort opts.fetch(:sort, [])
end

Instance Method Details

#resultsObject



21
22
23
# File 'lib/garb/report.rb', line 21

def results
  ReportResponse.new(send_request_for_body).results
end