Class: Webtrends::Event

Inherits:
Service show all
Defined in:
lib/webtrends/event.rb

Instance Attribute Summary collapse

Attributes inherited from Service

#customer_id, #domain, #format, #protocol, #service, #verbose, #version

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Event

Returns a new instance of Event.



6
7
8
9
10
# File 'lib/webtrends/event.rb', line 6

def initialize(args = {})
  super
  self.tags = args.fetch(:tags, {})
  self.service = args.fetch(:service, Webtrends.configuration.event_service)
end

Instance Attribute Details

#tagsObject

Returns the value of attribute tags.



4
5
6
# File 'lib/webtrends/event.rb', line 4

def tags
  @tags
end

Instance Method Details

#trackObject



12
13
14
15
16
17
18
# File 'lib/webtrends/event.rb', line 12

def track
  if !tags.nil? && !tags.empty?
    RestClient.post endpoint, options.merge(tags)
  end
rescue => ex
  raise Webtrends::Exception.new(ex)
end