Class: AmplitudeAPI::Event
- Inherits:
-
Object
- Object
- AmplitudeAPI::Event
- Defined in:
- lib/amplitude-api/event.rb
Instance Attribute Summary collapse
-
#event_properties ⇒ String
The event_properties to be attached to the Amplitude Event.
-
#event_type ⇒ String
The event_type to be sent to Amplitude.
-
#user_id ⇒ String
The user_id to be sent to Amplitude.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Compares
to_hashfor equality. -
#initialize(user_id:, event_type:, event_properties: {}) ⇒ Event
constructor
Create a new Event.
-
#to_hash ⇒ Hash
Used for serialization and comparison.
Constructor Details
#initialize(user_id:, event_type:, event_properties: {}) ⇒ Event
Create a new Event
18 19 20 21 22 |
# File 'lib/amplitude-api/event.rb', line 18 def initialize(user_id: , event_type: , event_properties: {}) self.user_id = user_id self.event_type = event_type self.event_properties = event_properties end |
Instance Attribute Details
#event_properties ⇒ String
Returns the event_properties to be attached to the Amplitude Event.
11 12 13 |
# File 'lib/amplitude-api/event.rb', line 11 def event_properties @event_properties end |
#event_type ⇒ String
Returns the event_type to be sent to Amplitude.
8 9 10 |
# File 'lib/amplitude-api/event.rb', line 8 def event_type @event_type end |
#user_id ⇒ String
Returns the user_id to be sent to Amplitude.
5 6 7 |
# File 'lib/amplitude-api/event.rb', line 5 def user_id @user_id end |
Instance Method Details
#==(other) ⇒ true, false
Compares to_hash for equality
47 48 49 50 51 52 53 |
# File 'lib/amplitude-api/event.rb', line 47 def ==(other) if other.respond_to?(:to_hash) self.to_hash == other.to_hash else false end end |
#to_hash ⇒ Hash
Used for serialization and comparison
36 37 38 39 40 41 42 |
# File 'lib/amplitude-api/event.rb', line 36 def to_hash { event_type: self.event_type, user_id: self.user_id, event_properties: self.event_properties } end |