Class: Rudder::Analytics

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/rudder/analytics.rb,
lib/rudder/analytics/utils.rb,
lib/rudder/analytics/client.rb,
lib/rudder/analytics/worker.rb,
lib/rudder/analytics/logging.rb,
lib/rudder/analytics/request.rb,
lib/rudder/analytics/version.rb,
lib/rudder/analytics/defaults.rb,
lib/rudder/analytics/response.rb,
lib/rudder/analytics/field_parser.rb,
lib/rudder/analytics/message_batch.rb,
lib/rudder/analytics/backoff_policy.rb

Defined Under Namespace

Modules: Defaults, Logging, Utils Classes: BackoffPolicy, Client, FieldParser, MessageBatch, PrefixedLogger, Request, Response, Worker

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Methods included from Logging

included, #logger

Constructor Details

#initialize(options = {}) ⇒ Analytics

Initializes a new instance of Client, to which all method calls are proxied.

Parameters:

Options Hash (options):

  • :stub (Boolean) — default: false

    If true, requests don’t hit the server and are stubbed to be successful.



20
21
22
23
# File 'lib/rudder/analytics.rb', line 20

def initialize(options = {})
  Request.stub = options[:stub] if options.has_key?(:stub)
  @client = Rudder::Analytics::Client.new options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(message, *args, &block) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/rudder/analytics.rb', line 25

def method_missing(message, *args, &block)
  if @client.respond_to? message
    @client.send message, *args, &block
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rudder/analytics.rb', line 33

def respond_to_missing?(method_name, include_private = false)
  @client.respond_to?(method_name) || super
end