Class: Garsh::Event
- Inherits:
-
Object
- Object
- Garsh::Event
- Defined in:
- lib/garsh.rb
Constant Summary collapse
- ENDPOINT =
"collect"
- EVENT_ID =
"event"
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#category ⇒ Object
Returns the value of attribute category.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#tracking_code ⇒ Object
readonly
Returns the value of attribute tracking_code.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Event
constructor
A new instance of Event.
- #to_params ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Event
Returns a new instance of Event.
44 45 46 47 48 49 50 51 52 |
# File 'lib/garsh.rb', line 44 def initialize(opts={}) # required @tracking_code = opts.fetch(:code) @action = opts.fetch(:action) # optional @client_id = opts.fetch(:client_id, "") @version = opts.fetch(:version, 1) @category = opts.fetch(:category, "") end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
38 39 40 |
# File 'lib/garsh.rb', line 38 def action @action end |
#category ⇒ Object
Returns the value of attribute category.
37 38 39 |
# File 'lib/garsh.rb', line 37 def category @category end |
#client_id ⇒ Object
Returns the value of attribute client_id.
36 37 38 |
# File 'lib/garsh.rb', line 36 def client_id @client_id end |
#tracking_code ⇒ Object (readonly)
Returns the value of attribute tracking_code.
35 36 37 |
# File 'lib/garsh.rb', line 35 def tracking_code @tracking_code end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
34 35 36 |
# File 'lib/garsh.rb', line 34 def version @version end |
Instance Method Details
#to_params ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/garsh.rb', line 54 def to_params { v: version, tid: tracking_code, cid: client_id, t: EVENT_ID, ec: category, ea: action } end |