Class: Gosquared::Tracking

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

Constant Summary collapse

BASEURL =
"https://api.gosquared.com/tracking/v1/".freeze
DIMENSIONS =
%w(event identify pageview ping properties timeout transaction).freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Tracking.



9
10
11
12
13
# File 'lib/gosquared/tracking.rb', line 9

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

Instance Method Details

#postObject



23
24
25
26
27
28
# File 'lib/gosquared/tracking.rb', line 23

def post
	check_for_nil_user
	response = @client.post(url, @data)
	@data = nil if response.code === '200'
	response
end

#urlObject



30
31
32
# File 'lib/gosquared/tracking.rb', line 30

def url
	url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
end