Class: GAEvents::Event
- Inherits:
-
Object
- Object
- GAEvents::Event
- Defined in:
- lib/gaevents/event.rb
Overview
Class to define analytical events expected attributes: tid, cid and t
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Event
constructor
As per Measurement Protocol, parameters: v, tid, cid and t should always be present.
- #payload ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Event
As per Measurement Protocol, parameters: v, tid, cid and t should always be present. This gem automatically injects v. Ensure you always pass tid, cid and t while initializing events.
17 18 19 20 |
# File 'lib/gaevents/event.rb', line 17 def initialize(hash = {}) @params = hash.select { |_k, v| v } @params['v'] = 1 end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
7 8 9 |
# File 'lib/gaevents/event.rb', line 7 def params @params end |
Instance Method Details
#payload ⇒ Object
22 23 24 |
# File 'lib/gaevents/event.rb', line 22 def payload URI.encode_www_form(@params) end |