Class: Gosquared::Now

Inherits:
Object
  • Object
show all
Defined in:
lib/gosquared/now.rb

Constant Summary collapse

BASEURL =
'https://api.gosquared.com/now/v3/'.freeze
DIMENSIONS =
%w[browsers campaigns concurrents engagement geo languages notifications
organisations overview pages platforms sources time timeSeries visitors].freeze
@@filters =
{ date_format: @date_format, from: @from, to: @to,
format: @format, limit: @limit, sort: @sort,
presenter: @presenter, visitors_mode: @string, href: @href,
drill_limit: @drill_limit, sections: @sections,
minimal: @minimal, interval: @interval }

Instance Method Summary collapse

Constructor Details

#initialize(api_key, site_token, client = Gosquared::Client.new) ⇒ Now

Returns a new instance of Now.



14
15
16
17
18
# File 'lib/gosquared/now.rb', line 14

def initialize(api_key, site_token, client = Gosquared::Client.new)
  @site_token = site_token
  @api_key = api_key
  @client = client
end

Instance Method Details

#fetchObject



34
35
36
37
38
# File 'lib/gosquared/now.rb', line 34

def fetch
  data = @client.get(url)
  @@filters.each { |key, _value| @@filters[key] = nil } if data
  data
end