tuktuk 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,6 +9,9 @@ response status codes -- like bounces, 5xx -- within your application.
9
9
 
10
10
  Plus, it supports DKIM out of the box.
11
11
 
12
+ Delivering mail
13
+ ---------------
14
+
12
15
  ``` ruby
13
16
  require 'tuktuk'
14
17
 
@@ -36,7 +39,14 @@ else
36
39
  end
37
40
  ```
38
41
 
39
- With Tuktuk, you can also deliver multiple messages at once. Depending on the max_workers config parameter, Tuktuk will either connect sequentially to the target MX servers, or do it in parallel by spawning threads. You need to pass an array of emails, and you'll receive an array of [response, email] elements, just as above.
42
+ Delivering multiple
43
+ -------------------
44
+
45
+ With Tuktuk, you can also deliver multiple messages at once. Depending on the `max_workers` config parameter, Tuktuk will either connect sequentially to the target domain's MX servers, or do it in parallel by spawning threads.
46
+
47
+ Tuktuk will try to send all emails targeted for a specific domain on the same SMTP session. If a MX server is not responding -- or times out in the middle --, Tuktuk will try to deliver the remaining messages to next MX server, and so on.
48
+
49
+ To #deliver_many, you need to pass an array of messages, and you'll receive an array of [response, email] elements, just as above.
40
50
 
41
51
  ``` ruby
42
52
  messages = [ { ... }, { ... }, { ... }, { ... } ] # array of messages
@@ -54,6 +64,9 @@ result.each do |response, email|
54
64
  end
55
65
  ```
56
66
 
67
+ Options & DKIM
68
+ --------------
69
+
57
70
  Now, if you want to enable DKIM (and you should):
58
71
 
59
72
  ``` ruby
data/lib/tuktuk/bounce.rb CHANGED
@@ -1,3 +1,5 @@
1
+ module Tuktuk
2
+
1
3
  class Bounce < RuntimeError
2
4
 
3
5
  HARD_BOUNCE_CODES = [
@@ -29,4 +31,6 @@ class Bounce < RuntimeError
29
31
  end
30
32
 
31
33
  class HardBounce < Bounce; end
32
- class SoftBounce < Bounce; end
34
+ class SoftBounce < Bounce; end
35
+
36
+ end
data/lib/tuktuk/cache.rb CHANGED
@@ -1,3 +1,5 @@
1
+ module Tuktuk
2
+
1
3
  class Cache
2
4
 
3
5
  attr_reader :store, :max_keys
@@ -26,3 +28,5 @@ class Cache
26
28
  end
27
29
 
28
30
  end
31
+
32
+ end
data/lib/tuktuk/dns.rb CHANGED
@@ -4,6 +4,8 @@ rescue
4
4
  require 'net/dns/resolve'
5
5
  end
6
6
 
7
+ module Tuktuk
8
+
7
9
  module DNS
8
10
 
9
11
  class << self
@@ -37,3 +39,5 @@ module DNS
37
39
  end
38
40
 
39
41
  end
42
+
43
+ end
@@ -4,6 +4,8 @@ class Mail::Message
4
4
  attr_accessor :array_index
5
5
  end
6
6
 
7
+ module Tuktuk
8
+
7
9
  module Package
8
10
 
9
11
  class << self
@@ -60,3 +62,5 @@ module Package
60
62
  end
61
63
 
62
64
  end
65
+
66
+ end
data/lib/tuktuk/tuktuk.rb CHANGED
@@ -3,6 +3,8 @@ require 'dkim'
3
3
  require 'logger'
4
4
  require 'work_queue'
5
5
 
6
+ module Tuktuk; end
7
+
6
8
  %w(package cache dns bounce).each { |lib| require "tuktuk/#{lib}" }
7
9
  require 'tuktuk/version' unless defined?(Tuktuk::VERSION)
8
10
 
@@ -1,7 +1,7 @@
1
1
  module Tuktuk
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- PATCH = 0
4
+ PATCH = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
data/spec/deliver_spec.rb CHANGED
@@ -69,10 +69,10 @@ describe 'deliver many' do
69
69
  @emails = [email, email, email]
70
70
 
71
71
  @success = mock('Net::SMTP::Response')
72
- @soft_email_bounce = SoftBounce.new('503 Sender already specified')
73
- @hard_email_bounce = HardBounce.new('505 Mailbox not found')
74
- @soft_server_bounce = SoftBounce.new('Be back in a sec')
75
- @hard_server_bounce = HardBounce.new('No MX records found.')
72
+ @soft_email_bounce = Tuktuk::SoftBounce.new('503 Sender already specified')
73
+ @hard_email_bounce = Tuktuk::HardBounce.new('505 Mailbox not found')
74
+ @soft_server_bounce = Tuktuk::SoftBounce.new('Be back in a sec')
75
+ @hard_server_bounce = Tuktuk::HardBounce.new('No MX records found.')
76
76
  end
77
77
 
78
78
  describe 'when domain exists' do
@@ -185,8 +185,8 @@ describe 'deliver many' do
185
185
  it 'should not mark first email as bounced' do
186
186
  Tuktuk.should_receive(:send_many_now).and_return([@first], [], [])
187
187
  responses = Tuktuk.send(:lookup_and_deliver_by_domain, 'domain.com', @emails)
188
- responses[1][0].should be_a(Bounce) if responses[1]
189
- responses[0][0].should_not be_a(Bounce)
188
+ responses[1][0].should be_a(Tuktuk::Bounce) if responses[1]
189
+ responses[0][0].should_not be_a(Tuktuk::Bounce)
190
190
  end
191
191
 
192
192
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuktuk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-24 00:00:00.000000000 Z
12
+ date: 2013-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler