griddler 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/app/controllers/griddler/emails_controller.rb +2 -0
- data/lib/griddler/email.rb +30 -2
- data/lib/griddler/email_parser.rb +4 -1
- data/lib/griddler/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 033ea4e395dad81582d32273bb841a0fc8cf00b2
|
4
|
+
data.tar.gz: da3e0f317134724e14dbe362de41882f121ebfdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753dddc90229903fa836cd31790164431603d3feda2dfa81b1e0a0cd17dc8f2e3428f09ed8fe210a4f54c5ca8e464dc85c86e1fbb5cdfa4f19abd73612a79738
|
7
|
+
data.tar.gz: ab5c5cea2b4d84bfed1e764f5a807bb847c9550c6b604d0ff1d71d33bfeb7df476b79c5500b985d25ccadd50091481c1be7132ee2c14a4c0d0a2f0f298f07acf
|
data/README.md
CHANGED
@@ -65,7 +65,7 @@ end
|
|
65
65
|
| `processor_class` | The class Griddler will use to handle your incoming emails.
|
66
66
|
| `email_class` | The class Griddler will use to represent an incoming e-mail. It must support an initializer that receives a hash as the only argument. We recommend inheriting it from Griddler::Email or checking this class to see all the methods it responds to.
|
67
67
|
| `processor_method` | The method Griddler will call on the processor class when handling your incoming emails.
|
68
|
-
| `reply_delimiter` | The string searched for that will split your body.
|
68
|
+
| `reply_delimiter` | The string searched for that will split your body. You can also supply an array of string - useful if you need translated versions of the delimiter
|
69
69
|
| `email_service` | Tells Griddler which email service you are using. The supported email service options are `:sendgrid` (the default), `:cloudmailin` (expects multipart format), `:postmark`, `:mandrill` and `:mailgun`. You will also need to have an appropriate [adapter] gem included in your Gemfile.
|
70
70
|
|
71
71
|
By default Griddler will look for a class named `EmailProcessor`. The class is
|
@@ -168,6 +168,7 @@ adapter gem in addition to `griddler`.
|
|
168
168
|
| Service | Adapter
|
169
169
|
| ------- | -------
|
170
170
|
| sendgrid | [griddler-sendgrid]
|
171
|
+
| cloudmailin | [griddler-cloudmailin]
|
171
172
|
| mandrill | [griddler-mandrill]
|
172
173
|
| mailgun | [griddler-mailgun]
|
173
174
|
| postmark | [griddler-postmark]
|
@@ -175,6 +176,7 @@ adapter gem in addition to `griddler`.
|
|
175
176
|
| ses (amazon)| [griddler-ses]
|
176
177
|
|
177
178
|
[griddler-sendgrid]: https://github.com/thoughtbot/griddler-sendgrid
|
179
|
+
[griddler-cloudmailin]: https://github.com/thoughtbot/griddler-cloudmailin
|
178
180
|
[griddler-mandrill]: https://github.com/wingrunr21/griddler-mandrill
|
179
181
|
[griddler-mailgun]: https://github.com/bradpauly/griddler-mailgun
|
180
182
|
[griddler-postmark]: https://github.com/r38y/griddler-postmark
|
@@ -215,6 +217,6 @@ Griddler was written by Caleb Thompson and Joel Oliveira.
|
|
215
217
|
|
216
218
|
Thanks to our [contributors](https://github.com/thoughtbot/griddler/contributors)!
|
217
219
|
|
218
|
-

|
219
221
|
|
220
222
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
data/lib/griddler/email.rb
CHANGED
@@ -3,8 +3,23 @@ require 'htmlentities'
|
|
3
3
|
module Griddler
|
4
4
|
class Email
|
5
5
|
include ActionView::Helpers::SanitizeHelper
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
attr_reader :to,
|
8
|
+
:from,
|
9
|
+
:cc,
|
10
|
+
:bcc,
|
11
|
+
:original_recipient,
|
12
|
+
:reply_to,
|
13
|
+
:subject,
|
14
|
+
:body,
|
15
|
+
:raw_body,
|
16
|
+
:raw_text,
|
17
|
+
:raw_html,
|
18
|
+
:headers,
|
19
|
+
:raw_headers,
|
20
|
+
:attachments,
|
21
|
+
:vendor_specific,
|
22
|
+
:spam_report
|
8
23
|
|
9
24
|
def initialize(params)
|
10
25
|
@params = params
|
@@ -22,10 +37,16 @@ module Griddler
|
|
22
37
|
|
23
38
|
@cc = recipients(:cc)
|
24
39
|
@bcc = recipients(:bcc)
|
40
|
+
@original_recipient = extract_address(params[:original_recipient])
|
41
|
+
@reply_to = extract_address(params[:reply_to])
|
25
42
|
|
26
43
|
@raw_headers = params[:headers]
|
27
44
|
|
28
45
|
@attachments = params[:attachments]
|
46
|
+
|
47
|
+
@vendor_specific = params.fetch(:vendor_specific, {})
|
48
|
+
|
49
|
+
@spam_report = params[:spam_report]
|
29
50
|
end
|
30
51
|
|
31
52
|
def to_h
|
@@ -42,9 +63,16 @@ module Griddler
|
|
42
63
|
headers: headers,
|
43
64
|
raw_headers: raw_headers,
|
44
65
|
attachments: attachments,
|
66
|
+
vendor_specific: vendor_specific,
|
67
|
+
spam_score: spam_score,
|
68
|
+
spam_report: spam_report,
|
45
69
|
}
|
46
70
|
end
|
47
71
|
|
72
|
+
def spam_score
|
73
|
+
@spam_report[:score] if @spam_report
|
74
|
+
end
|
75
|
+
|
48
76
|
private
|
49
77
|
|
50
78
|
attr_reader :params
|
@@ -84,7 +84,10 @@ module Griddler::EmailParser
|
|
84
84
|
/^On.*<\r?\n?.*>.*\r?\n?wrote:\r?\n?$/,
|
85
85
|
/On.*wrote:/,
|
86
86
|
/\*?From:.*$/i,
|
87
|
-
/^[[:space:]]*\d{4}[-\/]\d{1,2}[-\/]\d{1,2}[[:space:]].*[[:space:]]<.*>?$/i
|
87
|
+
/^[[:space:]]*\d{4}[-\/]\d{1,2}[-\/]\d{1,2}[[:space:]].*[[:space:]]<.*>?$/i,
|
88
|
+
/(_)*\n[[:space:]]*De :.*\n[[:space:]]*Envoyé :.*\n[[:space:]]*À :.*\n[[:space:]]*Objet :.*\n$/i, # French Outlook
|
89
|
+
/^[[:space:]]*\>?[[:space:]]*Le.*<\n?.*>.*\n?a[[:space:]]?\n?écrit :$/, # French
|
90
|
+
/^[[:space:]]*\>?[[:space:]]*El.*<\n?.*>.*\n?escribió:$/ # Spanish
|
88
91
|
]
|
89
92
|
end
|
90
93
|
|
data/lib/griddler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: griddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Thompson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -122,7 +122,8 @@ files:
|
|
122
122
|
- lib/griddler/testing.rb
|
123
123
|
- lib/griddler/version.rb
|
124
124
|
homepage: http://thoughtbot.com
|
125
|
-
licenses:
|
125
|
+
licenses:
|
126
|
+
- MIT
|
126
127
|
metadata: {}
|
127
128
|
post_install_message:
|
128
129
|
rdoc_options: []
|