Module: MandrillQueue::MandrillApi

Included in:
Worker
Defined in:
lib/mandrill_queue/mandrill_api.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#configurationObject



8
9
10
# File 'lib/mandrill_queue/mandrill_api.rb', line 8

def configuration
	MandrillQueue.configuration
end

#mandrillObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mandrill_queue/mandrill_api.rb', line 12

def mandrill
	@_api ||= begin
		if configuration.api_key.nil?
			raise MandrillQueue::Api::Error, <<-ERR
			An Api key has not been configured. Please configure on as follows in an initializer:
			MandrillQueue.configure do { |c| c.api_key = 'xxxxxxxxxxxxxx' }
			ERR
		end

		Mandrill::API.new(configuration.api_key)
	end
end