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 =
5
- VERSION =
[MAJOR, MINOR, PATCH].join('.')
Class Method Summary
collapse
Class Method Details
.cache ⇒ Object
27
28
29
|
# File 'lib/tuktuk/tuktuk.rb', line 27
def cache
@cache ||= Cache.new(100)
end
|
.deliver(message, opts = {}) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/tuktuk/tuktuk.rb', line 31
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
40
41
42
43
44
45
46
47
48
|
# File 'lib/tuktuk/tuktuk.rb', line 40
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
50
51
52
53
54
55
|
# File 'lib/tuktuk/tuktuk.rb', line 50
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
64
65
66
67
68
|
# File 'lib/tuktuk/tuktuk.rb', line 64
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
57
58
59
60
61
62
|
# File 'lib/tuktuk/tuktuk.rb', line 57
def options=(hash)
if dkim_opts = hash.delete(:dkim)
self.dkim = dkim_opts
end
config.merge!(hash)
end
|