Module: Tuktuk
- Defined in:
- lib/tuktuk/dns.rb,
lib/tuktuk/cache.rb,
lib/tuktuk/rails.rb,
lib/tuktuk/bounce.rb,
lib/tuktuk/tuktuk.rb,
lib/tuktuk/tuktuk.rb,
lib/tuktuk/version.rb,
lib/tuktuk/package.rb
Defined Under Namespace
Modules: DNS, Package
Classes: Bounce, Cache, HardBounce, SoftBounce
Constant Summary
collapse
- MAJOR =
0
- MINOR =
6
- PATCH =
0
- VERSION =
[MAJOR, MINOR, PATCH].join('.')
Class Method Summary
collapse
Class Method Details
.cache ⇒ Object
25
26
27
|
# File 'lib/tuktuk/tuktuk.rb', line 25
def cache
@cache ||= Cache.new(100)
end
|
.deliver(message, opts = {}) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/tuktuk/tuktuk.rb', line 29
def deliver(message, opts = {})
self.options = opts if opts.any?
mail = Package.build(message)
response = lookup_and_deliver(mail)
return response, mail
end
|
.deliver!(mail) ⇒ Object
same as deliver but raises error. used by ActionMailer
38
39
40
41
42
43
44
45
46
|
# File 'lib/tuktuk/tuktuk.rb', line 38
def deliver!(mail)
@logger = Rails.logger if defined?(Rails) and !config[:log_to]
resp, email = deliver(mail)
if resp.is_a?(Exception)
raise resp
else
return resp, email
end
end
|
.deliver_many(messages, opts = {}) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/tuktuk/tuktuk.rb', line 48
def deliver_many(messages, opts = {})
raise ArgumentError, "Not an array of messages: #{messages.inspect}" unless messages.any?
self.options = opts if opts.any?
messages_by_domain = reorder_by_domain(messages)
lookup_and_deliver_many(messages_by_domain)
end
|
.dkim=(dkim_opts) ⇒ Object
62
63
64
65
66
|
# File 'lib/tuktuk/tuktuk.rb', line 62
def dkim=(dkim_opts)
Dkim::domain = dkim_opts[:domain]
Dkim::selector = dkim_opts[:selector]
Dkim::private_key = dkim_opts[:private_key]
end
|
.new(options) ⇒ Object
7
8
9
10
|
# File 'lib/tuktuk/rails.rb', line 7
def self.new(options)
self.options = options
self
end
|
.options=(hash) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/tuktuk/tuktuk.rb', line 55
def options=(hash)
if dkim_opts = hash.delete(:dkim)
self.dkim = dkim_opts
end
config.merge!(hash)
end
|