Class: LucidIntercom::Event
- Inherits:
-
Object
- Object
- LucidIntercom::Event
- Defined in:
- lib/lucid_intercom/event.rb
Direct Known Subclasses
Class Method Summary collapse
-
.event(name) ⇒ Object
Set the event name for the subclass.
Instance Method Summary collapse
-
#initialize(post_request: Container[:post_request], update_user: Container[:update_user]) ⇒ Event
constructor
A new instance of Event.
- #notify(shopify_data_or_user, *args) ⇒ Object (also: #call)
Constructor Details
#initialize(post_request: Container[:post_request], update_user: Container[:update_user]) ⇒ Event
Returns a new instance of Event.
11 12 13 14 15 |
# File 'lib/lucid_intercom/event.rb', line 11 def initialize(post_request: Container[:post_request], update_user: Container[:update_user]) @post_request = post_request @update_user = update_user end |
Class Method Details
.event(name) ⇒ Object
Set the event name for the subclass.
66 67 68 69 70 |
# File 'lib/lucid_intercom/event.rb', line 66 def self.event(name) define_method(:name) { "#{LucidIntercom.config.app_prefix}_#{name}" } private :name end |
Instance Method Details
#notify(shopify_data_or_user, *args) ⇒ Object Also known as: call
21 22 23 24 25 26 27 28 |
# File 'lib/lucid_intercom/event.rb', line 21 def notify(shopify_data_or_user, *args) user = shopify_data_or_user user = UserAttributes.new(user, app_data(*args)) if user.is_a?(Hash) @post_request.('events', data(user, *args)).assert! @update_user.(user) end |