Class: Itly::Event
- Inherits:
-
Object
- Object
- Itly::Event
- Defined in:
- lib/itly/event.rb
Overview
Event object used to communicate data between Itly core SDK and its plugins
Properties: name
: The event’s name. properties
: The event’s properties. id
: The event’s unique ID in Iteratively. version
: The event’s version, e.g. 2.0.1. plugins
: Granular Event Destinations: to control to which plugin to forward this event to
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#==(other) ⇒ True/False
Compare the object to another.
-
#initialize(name:, properties: {}, id: nil, version: nil, plugins: {}) ⇒ Event
constructor
Create a new Event object.
-
#to_s ⇒ String
Describe the object.
Constructor Details
#initialize(name:, properties: {}, id: nil, version: nil, plugins: {}) ⇒ Event
Create a new Event object
26 27 28 29 30 31 32 |
# File 'lib/itly/event.rb', line 26 def initialize(name:, properties: {}, id: nil, version: nil, plugins: {}) @name = name @properties = properties @id = id @version = version @plugins = plugins.transform_keys(&:to_s) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/itly/event.rb', line 15 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/itly/event.rb', line 15 def name @name end |
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
15 16 17 |
# File 'lib/itly/event.rb', line 15 def plugins @plugins end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
15 16 17 |
# File 'lib/itly/event.rb', line 15 def properties @properties end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
15 16 17 |
# File 'lib/itly/event.rb', line 15 def version @version end |
Instance Method Details
#==(other) ⇒ True/False
Compare the object to another
53 54 55 56 |
# File 'lib/itly/event.rb', line 53 def ==(other) other.class == self.class && [name, properties, id, version] == [other.name, other.properties, other.id, other.version] end |
#to_s ⇒ String
Describe the object
39 40 41 42 43 44 |
# File 'lib/itly/event.rb', line 39 def to_s str = "#<#{self.class.name}: name: #{name}, " str += "id: #{id}, " unless id.nil? str += "version: #{version}, " unless version.nil? str + "properties: #{properties}>" end |