Class: Redemption::Confirm

Inherits:
Object
  • Object
show all
Defined in:
lib/redemption/confirm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reward) ⇒ Confirm

Returns a new instance of Confirm.



7
8
9
# File 'lib/redemption/confirm.rb', line 7

def initialize(reward)
  @reward = reward
end

Instance Attribute Details

#rewardObject

Returns the value of attribute reward.



5
6
7
# File 'lib/redemption/confirm.rb', line 5

def reward
  @reward
end

Instance Method Details

#error_messagesObject



29
30
31
# File 'lib/redemption/confirm.rb', line 29

def error_messages
  reward.errors.full_messages.to_sentence
end

#executeObject



19
20
21
22
23
24
25
26
27
# File 'lib/redemption/confirm.rb', line 19

def execute
  execute!
rescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid => e
  HH_LOGGER.info e
  false
rescue StandardError => e
  APMErrorHandler.report e
  false
end

#execute!Object



11
12
13
14
15
16
17
# File 'lib/redemption/confirm.rb', line 11

def execute!
  reward.transaction do
    confirm_reward!
    send_notification
  end
  true
end