Class: TalonOne::Integration::Event
- Inherits:
-
Object
- Object
- TalonOne::Integration::Event
- Defined in:
- lib/integration/event.rb
Instance Method Summary collapse
- #accepted_coupon? ⇒ Boolean
- #accepted_referral? ⇒ Boolean
- #attributes ⇒ Object
- #effects ⇒ Object
-
#initialize(raw_data) ⇒ Event
constructor
A new instance of Event.
- #rejected_coupon? ⇒ Boolean
- #rejected_referral? ⇒ Boolean
- #session_id ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(raw_data) ⇒ Event
Returns a new instance of Event.
6 7 8 |
# File 'lib/integration/event.rb', line 6 def initialize(raw_data) @raw = raw_data end |
Instance Method Details
#accepted_coupon? ⇒ Boolean
28 29 30 |
# File 'lib/integration/event.rb', line 28 def accepted_coupon? effects.any? {|e| e.function == "acceptCoupon"} end |
#accepted_referral? ⇒ Boolean
36 37 38 |
# File 'lib/integration/event.rb', line 36 def accepted_referral? effects.any? {|e| e.function == "acceptReferral"} end |
#attributes ⇒ Object
18 19 20 |
# File 'lib/integration/event.rb', line 18 def attributes @raw["attributes"] end |
#effects ⇒ Object
22 23 24 25 26 |
# File 'lib/integration/event.rb', line 22 def effects @effects ||= @raw["effects"].map do |raw_array| TalonOne::Integration::Effect.new raw_array end end |
#rejected_coupon? ⇒ Boolean
32 33 34 |
# File 'lib/integration/event.rb', line 32 def rejected_coupon? !accepted_coupon? && effects.any? {|e| e.function == "rejectCoupon"} end |
#rejected_referral? ⇒ Boolean
40 41 42 |
# File 'lib/integration/event.rb', line 40 def rejected_referral? !accepted_referral? && effects.any? {|e| e.function == "rejectReferral"} end |
#session_id ⇒ Object
14 15 16 |
# File 'lib/integration/event.rb', line 14 def session_id @raw["sessionId"] end |
#type ⇒ Object
10 11 12 |
# File 'lib/integration/event.rb', line 10 def type @raw["type"] end |