lib/framed_rails.rb in framed_rails-0.1.7 vs lib/framed_rails.rb in framed_rails-0.2.0
- old
+ new
@@ -21,15 +21,15 @@
:authenticity_token,
:commit,
:password]
class << self
- attr_accessor :client, :consumer
+ attr_accessor :client, :emitter
def configuration
@configuration ||= {
- :consumer => Framed::Emitters::Blocking,
+ :emitter => Framed::Emitters::Blocking,
:user_id_controller_method => 'framed_current_user_id',
:endpoint => Framed::FRAMED_API_ENDPOINT,
:logger => Logger.new(STDERR),
:anonymous_cookie => Framed::COOKIE_NAME,
:include_xhr => false,
@@ -39,32 +39,32 @@
def excluded_params
(configuration[:excluded_params] + DEFAULT_EXCLUDED_PARAMS).uniq
end
- def configure(silent = false)
+ def configure
yield configuration
self.client = Client.new(configuration)
- @consumer.stop(true) if @consumer
- @consumer = configuration[:consumer].new(self.client)
+ @emitter.stop(true) if @emitter
+ @emitter = configuration[:emitter].new(self.client)
end
def report(event)
- event[:lib] = "framed_ruby"
+ event[:lib] = 'framed_ruby'
event[:lib_version] = Framed::VERSION
event[:type] ||= :track
event[:context] ||= {}
event[:context].merge!({
- :channel => 'server',
+ :channel => 'server'
})
event[:properties] ||= {}
# fill in if needed, in case it sits in queue for a while.
event[:timestamp] ||= Framed::Utils.serialize_date(Time.now)
- @consumer.enqueue(event)
+ @emitter.enqueue(event)
end
def logger
configuration[:logger]
end
@@ -76,10 +76,10 @@
def log_error(msg)
logger.error(LOG_PREFIX + msg)
end
def drain
- @consumer.stop(true) if @consumer
+ @emitter.stop(true) if @emitter
end
def user_id_controller_method
configuration[:user_id_controller_method]
end