Class: RudderAnalyticsSync::Client

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/rudder_analytics_sync/client.rb

Constant Summary

Constants included from Utils

Utils::UTC_OFFSET_WITHOUT_COLON, Utils::UTC_OFFSET_WITH_COLON

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#date_in_iso8601, #formatted_offset, included, #isoify_dates, #isoify_dates!, #maybe_datetime_in_iso8601, #seconds_to_utc_offset, #symbolize_keys, #time_in_iso8601, #uid, #valid_date?

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



14
15
16
# File 'lib/rudder_analytics_sync/client.rb', line 14

def initialize(options = {})
  @config = Configuration.new(options)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/rudder_analytics_sync/client.rb', line 12

def config
  @config
end

Instance Method Details

#alias(options) ⇒ Object



91
92
93
# File 'lib/rudder_analytics_sync/client.rb', line 91

def alias(options)
  Operations::Alias.new(self, symbolize_keys(options)).call
end

#batch {|batch| ... } ⇒ Object

Examples:

client.batch do |analytics|
  analytics.context = { 'foo' => 'bar' }
  analytics.identify(user_id: 'id')
  analytics.track(event: 'Delivered Package', user_id: 'id')
end

Yields:

  • (batch)

    Yields a special batch object that can be used to group ‘identify`, `track`, `page` and `group` calls into a single API request.



104
105
106
107
108
# File 'lib/rudder_analytics_sync/client.rb', line 104

def batch
  batch = Batch.new(self)
  yield(batch)
  batch.commit
end

#flushObject

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



111
# File 'lib/rudder_analytics_sync/client.rb', line 111

def flush; end

#group(options) ⇒ Object



78
79
80
# File 'lib/rudder_analytics_sync/client.rb', line 78

def group(options)
  Operations::Group.new(self, symbolize_keys(options)).call
end

#identify(options) ⇒ Object



26
27
28
# File 'lib/rudder_analytics_sync/client.rb', line 26

def identify(options)
  Operations::Identify.new(self, symbolize_keys(options)).call
end

#page(options) ⇒ Object



52
53
54
# File 'lib/rudder_analytics_sync/client.rb', line 52

def page(options)
  Operations::Page.new(self, symbolize_keys(options)).call
end

#screen(options) ⇒ Object



65
66
67
# File 'lib/rudder_analytics_sync/client.rb', line 65

def screen(options)
  Operations::Screen.new(self, symbolize_keys(options)).call
end

#track(options) ⇒ Object



39
40
41
# File 'lib/rudder_analytics_sync/client.rb', line 39

def track(options)
  Operations::Track.new(self, symbolize_keys(options)).call
end