Class: Gosquared::Trends

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

Constant Summary collapse

BASEURL =
'https://api.gosquared.com/trends/v2/'.freeze
DIMENSIONS =
%w[aggregate browser category country event language organisation os page path1 product screenDimensions sources transactions].freeze
@@filters =
{ date_format: @date_format, from: @from, to: @to,
format: @format, limit: @limit, sort: @sort, group: @group,
source_type: @source_type }

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Trends.


11
12
13
14
15
# File 'lib/gosquared/trends.rb', line 11

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


31
32
33
34
35
# File 'lib/gosquared/trends.rb', line 31

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