module Sampl

Constants

VERSION

Public Class Methods

app_token(app_token=nil) click to toggle source
# File lib/sampl.rb, line 106
def self.app_token(app_token=nil)
  Basement.app_token(app_token)
end
endpoint(endpoint=nil) click to toggle source

change the URI where to send the events. Please note this that chaging this on the static inteface of Sampl directly (Sampl.endpoint=“my.url.com”) will affect the whole app and all tracking calls to Sampl. Thus, all workers in a Rails app will send events to the same endpoint when working with the static interface. Use custom classes when in need for different endpoints.

# File lib/sampl.rb, line 102
def self.endpoint(endpoint=nil)
  Basement.endpoint(endpoint)
end
included(base) click to toggle source
# File lib/sampl.rb, line 7
def self.included(base)
  base.extend ClassMethods
  # the following inheritance pattern was explained in this block post by John Nunemaker:
  # http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/
  # We borrow its implementation from HTTParty so usage is as close to HTTParty as possible.
  base.send :include, HTTParty::ModuleInheritableAttributes
  base.send(:mattr_inheritable, :default_arguments)
  base.send(:mattr_inheritable, :default_endpoint)
  base.instance_variable_set("@default_arguments", {
    sdk:            "Sampl.rb",
    sdk_version:    Sampl::VERSION,
    event_category: "custom",
    server_side:    true
  })
  base.instance_variable_set("@default_endpoint", "https://events.neurometry.com/sample/v01/event")
end
server_side(flag=nil) click to toggle source
# File lib/sampl.rb, line 110
def self.server_side(flag=nil)
  Basement.server_side(flag)
end
track(*args, &block) click to toggle source
# File lib/sampl.rb, line 114
def self.track(*args, &block)
  Basement.track(*args, &block)
end
version(*args, &block) click to toggle source
# File lib/sampl.rb, line 118
def self.version(*args, &block)
  Basement.version(*args, &block)
end