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 =
7
- PATCH =
1
- 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
38
39
40
|
# File 'lib/tuktuk/tuktuk.rb', line 31
def deliver(message, opts = {})
bcc = opts.delete(:bcc) || []
bcc = [bcc] if bcc.is_a?(String)
self.options = opts if opts.any?
mail = Package.build(message)
response = lookup_and_deliver(mail, bcc)
return response, mail
end
|
.deliver!(mail, opts = {}) ⇒ Object
same as deliver but raises error. used by ActionMailer
43
44
45
46
47
48
49
50
51
|
# File 'lib/tuktuk/tuktuk.rb', line 43
def deliver!(mail, opts = {})
@logger = Rails.logger if defined?(Rails) and !config[:log_to]
resp, email = deliver(mail, opts)
if resp.is_a?(Exception)
raise resp
else
return resp, email
end
end
|
.deliver_many(messages, opts = {}) ⇒ Object
53
54
55
56
57
58
|
# File 'lib/tuktuk/tuktuk.rb', line 53
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
67
68
69
70
71
|
# File 'lib/tuktuk/tuktuk.rb', line 67
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
60
61
62
63
64
65
|
# File 'lib/tuktuk/tuktuk.rb', line 60
def options=(hash)
if dkim_opts = hash.delete(:dkim)
self.dkim = dkim_opts
end
config.merge!(hash)
end
|