class SidekiqStrategies::Helper
Attributes
acc_handler[RW]
Public Class Methods
new(acc_handler, url_helper)
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 6 def initialize(acc_handler, url_helper) @acc_handler = acc_handler self.class.send(:include, url_helper) end
Public Instance Methods
queue_message()
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 19 def queue_message @acc_handler.transaction.provider.queue_options.merge( { action: @acc_handler.action_name, account: @acc_handler.account.id, number: @acc_handler.account.number, service: @acc_handler.account.service.slug, fields: @acc_handler.transaction.fields, retry_count: @acc_handler.transaction.retry_count, request_tube: @acc_handler.transaction.provider.queue, reply_tube: reply_tube_name, account_url: account_url(@acc_handler.account) } ) end
reply_tube_name()
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 11 def reply_tube_name "#{@acc_handler.account.country.code}-#{@acc_handler.account.id}" end
request_tube_name()
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 15 def request_tube_name @acc_handler.transaction.provider.queue end
try_again?(exception)
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 35 def try_again?(exception) return false if @acc_handler.transaction.retry_count >= 2 return exception[:retry_action] if exception.kind_of?(Hash) return exception.retry_action if exception.respond_to?(:retry_action) false end
Private Instance Methods
account_url(account)
click to toggle source
# File lib/sidekiq_strategies/helper.rb, line 44 def account_url(account) v1_account_url cc: account.country_code, slug: account.service.slug, id: account.id end