Class: TalonOne::Integration::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/integration/event.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


28
29
30
# File 'lib/integration/event.rb', line 28

def accepted_coupon?
  effects.any? {|e| e.function == "acceptCoupon"}
end

#accepted_referral?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/integration/event.rb', line 36

def accepted_referral?
  effects.any? {|e| e.function == "acceptReferral"}
end

#attributesObject



18
19
20
# File 'lib/integration/event.rb', line 18

def attributes
  @raw["attributes"]
end

#effectsObject



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

Returns:

  • (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

Returns:

  • (Boolean)


40
41
42
# File 'lib/integration/event.rb', line 40

def rejected_referral?
  !accepted_referral? && effects.any? {|e| e.function == "rejectReferral"}
end

#session_idObject



14
15
16
# File 'lib/integration/event.rb', line 14

def session_id
  @raw["sessionId"]
end

#typeObject



10
11
12
# File 'lib/integration/event.rb', line 10

def type
  @raw["type"]
end