Class: Mixpanelable::EventBuilder
- Inherits:
-
Object
- Object
- Mixpanelable::EventBuilder
- Defined in:
- lib/mixpanelable/event_builder.rb
Instance Attribute Summary collapse
-
#active_record ⇒ Object
readonly
Returns the value of attribute active_record.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#unique_to_request ⇒ Object
readonly
Returns the value of attribute unique_to_request.
Instance Method Summary collapse
- #distinct_id ⇒ Object
- #event ⇒ Object
-
#initialize(args = {}) ⇒ EventBuilder
constructor
A new instance of EventBuilder.
Constructor Details
#initialize(args = {}) ⇒ EventBuilder
Returns a new instance of EventBuilder.
5 6 7 8 9 10 11 |
# File 'lib/mixpanelable/event_builder.rb', line 5 def initialize(args = {}) @active_record = args[:active_record] @name = args[:name] @properties = args[:properties] @unique_to_request = args[:unique_to_request] self end |
Instance Attribute Details
#active_record ⇒ Object (readonly)
Returns the value of attribute active_record.
3 4 5 |
# File 'lib/mixpanelable/event_builder.rb', line 3 def active_record @active_record end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/mixpanelable/event_builder.rb', line 3 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
3 4 5 |
# File 'lib/mixpanelable/event_builder.rb', line 3 def properties @properties end |
#unique_to_request ⇒ Object (readonly)
Returns the value of attribute unique_to_request.
3 4 5 |
# File 'lib/mixpanelable/event_builder.rb', line 3 def unique_to_request @unique_to_request end |
Instance Method Details
#distinct_id ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mixpanelable/event_builder.rb', line 17 def distinct_id case when active_record.present? distinct_id_for(active_record) when unique_to_request request_uuid when current_user.present? distinct_id_for(current_user) else guest_uuid end end |