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, #instance_klass, #page_params, #params, #segment, #segment_params, #send_request_for_body, #set_instance_klass, #set_segment_id

Constructor Details

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

Returns a new instance of Report.



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

def initialize(profile, opts={})
  ActiveSupport::Deprecation.warn("The use of Report will be removed in favor of 'extend Garb::Model'")

  @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



23
24
25
# File 'lib/garb/report.rb', line 23

def results
  ReportResponse.new(send_request_for_body).results
end