Class: Spree::BaseAnalyticsEventHandler
- Inherits:
-
Object
- Object
- Spree::BaseAnalyticsEventHandler
- Defined in:
- app/models/spree/base_analytics_event_handler.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#visitor_id ⇒ Object
readonly
Returns the value of attribute visitor_id.
Instance Method Summary collapse
-
#client ⇒ Object
Returns the client.
-
#event_human_name(event_name) ⇒ String
Returns the human name for the event.
-
#handle_event(event_name, properties = {}) ⇒ Object
Handles the event rubocop:disable Lint/UnusedMethodArgument.
-
#initialize(opts = {}) ⇒ BaseAnalyticsEventHandler
constructor
Initializes the event handler.
Constructor Details
#initialize(opts = {}) ⇒ BaseAnalyticsEventHandler
Initializes the event handler
9 10 11 12 13 14 15 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 9 def initialize(opts = {}) @user = opts[:user] @session = opts[:session] @request = opts[:request] @store = opts[:store] @visitor_id = opts[:visitor_id] end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
17 18 19 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 17 def request @request end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
17 18 19 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 17 def session @session end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
17 18 19 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 17 def store @store end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
17 18 19 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 17 def user @user end |
#visitor_id ⇒ Object (readonly)
Returns the value of attribute visitor_id.
17 18 19 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 17 def visitor_id @visitor_id end |
Instance Method Details
#client ⇒ Object
Returns the client
21 22 23 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 21 def client raise NotImplementedError, 'Subclasses must implement the client method' end |
#event_human_name(event_name) ⇒ String
Returns the human name for the event
37 38 39 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 37 def event_human_name(event_name) Analytics.events[event_name.to_sym] end |
#handle_event(event_name, properties = {}) ⇒ Object
Handles the event rubocop:disable Lint/UnusedMethodArgument
29 30 31 |
# File 'app/models/spree/base_analytics_event_handler.rb', line 29 def handle_event(event_name, properties = {}) raise NotImplementedError, 'Subclasses must implement the handle method' end |