Class: ShopCircle::Orbit::Event
- Inherits:
-
Object
- Object
- ShopCircle::Orbit::Event
- Defined in:
- lib/shopcircle/orbit/event.rb
Instance Attribute Summary collapse
-
#avatar ⇒ Object
readonly
Returns the value of attribute avatar.
-
#device_id ⇒ Object
readonly
Returns the value of attribute device_id.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#profile_id ⇒ Object
readonly
Returns the value of attribute profile_id.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, name: nil, profile_id: nil, device_id: nil, properties: nil, first_name: nil, last_name: nil, email: nil, avatar: nil) ⇒ Event
constructor
A new instance of Event.
- #to_payload ⇒ Object
Constructor Details
#initialize(type:, name: nil, profile_id: nil, device_id: nil, properties: nil, first_name: nil, last_name: nil, email: nil, avatar: nil) ⇒ Event
Returns a new instance of Event.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shopcircle/orbit/event.rb', line 10 def initialize(type:, name: nil, profile_id: nil, device_id: nil, properties: nil, first_name: nil, last_name: nil, email: nil, avatar: nil) @type = type @name = name @profile_id = profile_id @device_id = device_id @properties = properties @first_name = first_name @last_name = last_name @email = email @avatar = avatar end |
Instance Attribute Details
#avatar ⇒ Object (readonly)
Returns the value of attribute avatar.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def avatar @avatar end |
#device_id ⇒ Object (readonly)
Returns the value of attribute device_id.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def device_id @device_id end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def last_name @last_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def name @name end |
#profile_id ⇒ Object (readonly)
Returns the value of attribute profile_id.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def profile_id @profile_id end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def properties @properties end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/shopcircle/orbit/event.rb', line 6 def type @type end |
Instance Method Details
#to_payload ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shopcircle/orbit/event.rb', line 24 def to_payload payload = {} payload[:name] = @name if @name payload[:profileId] = @profile_id if @profile_id payload[:deviceId] = @device_id if @device_id payload[:firstName] = @first_name if @first_name payload[:lastName] = @last_name if @last_name payload[:email] = @email if @email payload[:avatar] = @avatar if @avatar payload[:properties] = normalize_keys(@properties) if @properties && !@properties.empty? { type: @type, payload: payload } end |