class Gosquared::Tracking
Constants
- BASEURL
- DIMENSIONS
Public Class Methods
new(api_key, site_token, client = Gosquared::Client.new)
click to toggle source
# File lib/gosquared/tracking.rb, line 8 def initialize(api_key, site_token, client = Gosquared::Client.new) @site_token = site_token @api_key = api_key @client = client end
Public Instance Methods
post()
click to toggle source
# File lib/gosquared/tracking.rb, line 22 def post check_for_nil_user response = @client.post(url, @data) @data = nil if response.code === '200' response end
url()
click to toggle source
# File lib/gosquared/tracking.rb, line 29 def url url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}" end
Private Instance Methods
check_for_nil_user()
click to toggle source
# File lib/gosquared/tracking.rb, line 35 def check_for_nil_user if @data.key?(:person_id) && @data[:person_id].nil? @data.tap { |_data| @data.delete(:person_id) } warn 'person_id is nil, event will not be track against a user' end end