Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make possibility to specify configurations for senders #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/vero/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Vero
class Config
attr_writer :domain
attr_accessor :api_key, :secret, :development_mode, :async, :disabled, :logging
attr_accessor :api_key, :secret, :development_mode, :async, :disabled, :logging, :senders_config

def self.available_attributes
[:api_key, :secret, :development_mode, :async, :disabled, :logging, :domain]
Expand Down Expand Up @@ -56,6 +56,10 @@ def reset!
self.logging = false
self.api_key = nil
self.secret = nil
self.senders_config = [:delayed_job, :resque, :sidekiq, :sucker_punch].inject({}) do |hash,e|
hash[e] = {}
hash
end
end

def update_attributes(attributes = {})
Expand Down
3 changes: 2 additions & 1 deletion lib/vero/senders/delayed_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module Vero
module Senders
class DelayedJob
def call(api_class, domain, options)
response = ::Delayed::Job.enqueue api_class.new(domain, options)
queue = Vero::App.default_context.config.senders_config.fetch(:delayed_job, {}).fetch(:queue, :default)
response = ::Delayed::Job.enqueue(api_class.new(domain, options), queue: queue)
options_s = JSON.dump(options)
Vero::App.log(self, "method: #{api_class.name}, options: #{options_s}, response: delayed job queued")
response
Expand Down
2 changes: 1 addition & 1 deletion lib/vero/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Vero
VERSION = '0.9.1'
VERSION = '0.9.2'
end