Class: GAEvents::Event
- Inherits:
-
Object
- Object
- GAEvents::Event
- Defined in:
- lib/gaevents/event.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#category ⇒ Object
Returns the value of attribute category.
-
#client ⇒ Object
Returns the value of attribute client.
-
#label ⇒ Object
Returns the value of attribute label.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(client, category, action, label = nil, value = nil) ⇒ Event
constructor
A new instance of Event.
- #params(tid) ⇒ Object
- #payload(tid) ⇒ Object
Constructor Details
#initialize(client, category, action, label = nil, value = nil) ⇒ Event
Returns a new instance of Event.
5 6 7 8 9 10 11 |
# File 'lib/gaevents/event.rb', line 5 def initialize(client, category, action, label = nil, value = nil) @client = client @category = category @action = action @label = label @value = value end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def action @action end |
#category ⇒ Object
Returns the value of attribute category.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def category @category end |
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def client @client end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def label @label end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def value @value end |
Instance Method Details
#params(tid) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gaevents/event.rb', line 13 def params(tid) params = { "v" => 1, "tid" => tid, "cid" => @client, "t" => "event", "ec" => @category, "ea" => @action, "el" => @label, "ev" => @value } params.reject! { |k,v| !v } end |
#payload(tid) ⇒ Object
27 28 29 |
# File 'lib/gaevents/event.rb', line 27 def payload(tid) URI.encode_www_form params(tid) end |