griddler 1.0.0.pre.beta.1 → 1.0.0.pre.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -35
- data/lib/griddler/testing.rb +4 -4
- data/lib/griddler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdb714b3a8525e8794d87ddb0fdd8925ac1ae39e
|
4
|
+
data.tar.gz: 8bcf701f4e310616683dea33d61305b991557e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76986506c6ff012f225b22f67942551795867728dff8e6f34fd3cbe221352bf04ecba58c7344386edde56a99c9226712a47c9b377d6301073354356d40e497a9
|
7
|
+
data.tar.gz: 5d74b1583264d8d4f9a24cc50ba68cf39d5b95e4e6da5638271e636b2c3afded4a79e3e23546ab588175f2d6149b5c6c11eab5b1c1661018ac2466cde7fa70eb
|
data/README.md
CHANGED
@@ -6,13 +6,9 @@ Griddler
|
|
6
6
|
|
7
7
|
### Receive emails in your Rails app
|
8
8
|
|
9
|
-
Griddler is a Rails engine that provides an endpoint for
|
10
|
-
|
11
|
-
|
12
|
-
[Postmark](http://developer.postmarkapp.com/developer-inbound-parse.html),
|
13
|
-
[Mandrill](http://help.mandrill.com/entries/21699367-Inbound-Email-Processing-Overview), or
|
14
|
-
[Mailgun](http://documentation.mailgun.com/user\_manual.html#receiving-messages-via-http-through-a-forward-action)
|
15
|
-
parse APIs that hands off a built email object to a class implemented by you.
|
9
|
+
Griddler is a Rails engine that provides an endpoint for services that convert
|
10
|
+
incoming emails to HTTP POST requests. It parses these POSTs and hands off a
|
11
|
+
built email object to a class implemented by you.
|
16
12
|
|
17
13
|
Tutorials
|
18
14
|
---------
|
@@ -58,13 +54,6 @@ Defaults are shown below with sample overrides following. In
|
|
58
54
|
Griddler.configure do |config|
|
59
55
|
config.processor_class = EmailProcessor # CommentViaEmail
|
60
56
|
config.processor_method = :process # :create_comment (A method on CommentViaEmail)
|
61
|
-
config.to = :hash # :full, :email, :token
|
62
|
-
config.cc = :email # :full, :hash, :token
|
63
|
-
config.from = :email # :full, :token, :hash
|
64
|
-
# :raw => 'AppName <s13.6b2d13dc6a1d33db7644@mail.myapp.com>'
|
65
|
-
# :email => 's13.6b2d13dc6a1d33db7644@mail.myapp.com'
|
66
|
-
# :token => 's13.6b2d13dc6a1d33db7644'
|
67
|
-
# :hash => { raw: [...], email: [...], token: [...], host: [...], name: [...] }
|
68
57
|
config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
|
69
58
|
config.email_service = :sendgrid # :cloudmailin, :postmark, :mandrill, :mailgun
|
70
59
|
end
|
@@ -76,15 +65,18 @@ end
|
|
76
65
|
| `processor_method` | The method Griddler will call on the processor class when handling your incoming emails.
|
77
66
|
| `reply_delimiter` | The string searched for that will split your body.
|
78
67
|
| `email_service` | Tells Griddler which email service you are using. The supported email service options are `:sendgrid` (the default), `:cloudmailin` (expects multipart format), `:postmark` and `:mandrill`. You will also need to have an appropriate [adapter] gem included in your Gemfile.
|
79
|
-
| `to`, `config.cc` and `config.from` | The format of the returned value for that address in the email object. `:hash` will return all options within a -- (surprise!) -- hash.
|
80
68
|
|
81
|
-
By default Griddler will look for a class named `EmailProcessor` with a
|
82
|
-
|
69
|
+
By default Griddler will look for a class named `EmailProcessor` with a method
|
70
|
+
named `process`, taking in one argument, a `Griddler::Email` instance
|
83
71
|
representing the incoming email. For example, in `./lib/email_processor.rb`:
|
84
72
|
|
85
73
|
```ruby
|
86
74
|
class EmailProcessor
|
87
|
-
def
|
75
|
+
def initialize(email)
|
76
|
+
@email = email
|
77
|
+
end
|
78
|
+
|
79
|
+
def process
|
88
80
|
# all of your application-specific code here - creating models,
|
89
81
|
# processing reports, etc
|
90
82
|
end
|
@@ -167,10 +159,12 @@ adapter gem in addition to `griddler`.
|
|
167
159
|
| sendgrid | [griddler-sendgrid]
|
168
160
|
| mandrill | [griddler-mandrill]
|
169
161
|
| mailgun | [griddler-mailgun]
|
162
|
+
| postmark | [griddler-postmark]
|
170
163
|
|
171
164
|
[griddler-sendgrid]: https://github.com/thoughtbot/griddler-sendgrid
|
172
165
|
[griddler-mandrill]: https://github.com/wingrunr21/griddler-mandrill
|
173
166
|
[griddler-mailgun]: https://github.com/bradpauly/griddler-mailgun
|
167
|
+
[griddler-postmark]: https://github.com/r38y/griddler-postmark
|
174
168
|
|
175
169
|
Writing an Adapter
|
176
170
|
------------------
|
@@ -199,28 +193,11 @@ Adapters should be provided as gems. If you write an adapter, let us know and we
|
|
199
193
|
will add it to this README. See [griddler-sendgrid] for an example
|
200
194
|
implementation.
|
201
195
|
|
202
|
-
More Information
|
203
|
-
----------------
|
204
|
-
|
205
|
-
* [SendGrid](http://www.sendgrid.com)
|
206
|
-
* [SendGrid Parse API](http://www.sendgrid.com/docs/API Reference/Webhooks/parse.html)
|
207
|
-
* [Cloudmailin](http://cloudmailin.com)
|
208
|
-
* [Cloudmailin Docs](http://docs.cloudmailin.com/)
|
209
|
-
* [Postmark](http://postmarkapp.com)
|
210
|
-
* [Postmark Docs](http://developer.postmarkapp.com/)
|
211
|
-
* [Mandrill](http://mandrill.com)
|
212
|
-
* [Mandrill Docs](http://help.mandrill.com/forums/21092258-Inbound-Email-Processing)
|
213
|
-
* [Mailgun](http://mailgun.com)
|
214
|
-
* [Mailgun Docs](http://documentation.mailgun.com/user\_manual.html#receiving-forwarding-and-storing-messages)
|
215
|
-
|
216
196
|
Credits
|
217
197
|
-------
|
218
198
|
|
219
199
|
Griddler was written by Caleb Thompson and Joel Oliveira.
|
220
200
|
|
221
|
-
Large portions of the codebase were extracted from thoughtbot's
|
222
|
-
[Trajectory](http://www.apptrajectory.com).
|
223
|
-
|
224
201
|
Thanks to our [contributors](https://github.com/thoughtbot/griddler/contributors)!
|
225
202
|
|
226
203
|
![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
|
data/lib/griddler/testing.rb
CHANGED
@@ -44,14 +44,14 @@ shared_examples_for 'Griddler adapter' do |adapter, service_params|
|
|
44
44
|
Array.wrap(normalized_params).each do |params|
|
45
45
|
email = Griddler::Email.new(params)
|
46
46
|
|
47
|
-
email.to.
|
47
|
+
expect(email.to).to eq([{
|
48
48
|
token: 'hi',
|
49
49
|
host: 'example.com',
|
50
50
|
full: 'Hello World <hi@example.com>',
|
51
51
|
email: 'hi@example.com',
|
52
52
|
name: 'Hello World',
|
53
53
|
}])
|
54
|
-
email.cc.
|
54
|
+
expect(email.cc).to eq [{
|
55
55
|
token: 'emily',
|
56
56
|
host: 'example.com',
|
57
57
|
email: 'emily@example.com',
|
@@ -81,8 +81,8 @@ RSpec::Matchers.define :be_normalized_to do |expected|
|
|
81
81
|
match do |actual|
|
82
82
|
expected.each do |k, v|
|
83
83
|
case v
|
84
|
-
when Regexp then actual[k].
|
85
|
-
else actual[k].
|
84
|
+
when Regexp then expect(actual[k]).to =~ v
|
85
|
+
else expect(actual[k]).to === v
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
data/lib/griddler/version.rb
CHANGED