class RudderAnalyticsSync::Client

Attributes

config[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/rudder_analytics_sync/client.rb, line 14
def initialize(options = {})
  @config = Configuration.new(options)
end

Public Instance Methods

alias(options) click to toggle source

@param [Hash] options @option :user_id @option :anonymous_id @option :previous_id required @option :traits [Hash] @option :context [Hash] @option :integrations [Hash] @option :timestamp [#iso8601] (Time.now)

# File lib/rudder_analytics_sync/client.rb, line 73
def alias(options)
  Operations::Alias.new(self, symbolize_keys(options)).call
end
batch() { |batch| ... } click to toggle source

@yield [batch] Yields a special batch object that can be used to group

`identify`, `track`, `page` and `group` calls into a
single API request.

@example

client.batch do |analytics|
  analytics.context = { 'foo' => 'bar' }
  analytics.identify(user_id: 'id')
  analytics.track(event: 'Delivered Package', user_id: 'id')
end
# File lib/rudder_analytics_sync/client.rb, line 86
def batch
  batch = Batch.new(self)
  yield(batch)
  batch.commit
end
flush() click to toggle source

A no op, added for backwards compatibility with `analytics-ruby`

# File lib/rudder_analytics_sync/client.rb, line 93
def flush; end
group(options) click to toggle source

@param [Hash] options @option :user_id @option :anonymous_id @option :group_id required @option :traits [Hash] @option :context [Hash] @option :integrations [Hash] @option :timestamp [#iso8601] (Time.now)

# File lib/rudder_analytics_sync/client.rb, line 61
def group(options)
  Operations::Group.new(self, symbolize_keys(options)).call
end
identify(options) click to toggle source

@param [Hash] options @option :user_id @option :anonymous_id @option :traits [Hash] @option :context [Hash] @option :integrations [Hash] @option :timestamp [#iso8601] (Time.now)

# File lib/rudder_analytics_sync/client.rb, line 25
def identify(options)
  Operations::Identify.new(self, symbolize_keys(options)).call
end
page(options) click to toggle source

@param [Hash] options @option :user_id @option :anonymous_id @option :name [String] @option :properties [Hash] @option :context [Hash] @option :integrations [Hash] @option :timestamp [#iso8601] (Time.now)

# File lib/rudder_analytics_sync/client.rb, line 49
def page(options)
  Operations::Page.new(self, symbolize_keys(options)).call
end
track(options) click to toggle source

@param [Hash] options @option :event [String] required @option :user_id @option :anonymous_id @option :properties [Hash] @option :context [Hash] @option :integrations [Hash] @option :timestamp [#iso8601] (Time.now)

# File lib/rudder_analytics_sync/client.rb, line 37
def track(options)
  Operations::Track.new(self, symbolize_keys(options)).call
end