griddler 1.2.1 → 1.3.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 +3 -3
- data/app/controllers/griddler/emails_controller.rb +2 -0
- data/lib/griddler/configuration.rb +1 -1
- data/lib/griddler/email.rb +8 -2
- data/lib/griddler/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa1ca112493637de599c4d500d4f7866bf6f9d2
|
4
|
+
data.tar.gz: 7982ae7c23c1c5166afc18666804087feedebe7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c542fe67d88aa3d1f717a44f595d08f7100df1accecf83c2ee31e9318f2731a5101567152309e06d9bd105e0ee310a586ee4904cd815ed2a54ce859e580c017f
|
7
|
+
data.tar.gz: 1ece4686acf277a564605c23e8d8418430cf43f9e7400466020fccd466d099f2277cd1ba3249e7c99a9aedfc0454cd985edd6e7971685f6242575ae3fd8a4422
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Tutorials
|
|
17
17
|
[great tutorial](http://blog.sendgrid.com/receiving-email-in-your-rails-app-with-griddler/)
|
18
18
|
on integrating Griddler with your application.
|
19
19
|
* We have our own blog post on the subject over at
|
20
|
-
[Giant Robots](
|
20
|
+
[Giant Robots](https://robots.thoughtbot.com/griddler-is-better-than-ever).
|
21
21
|
|
22
22
|
Installation
|
23
23
|
------------
|
@@ -66,7 +66,7 @@ end
|
|
66
66
|
| `reply_delimiter` | The string searched for that will split your body.
|
67
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`, `:mandrill` and `:mailgun`. You will also need to have an appropriate [adapter] gem included in your Gemfile.
|
68
68
|
|
69
|
-
By default Griddler will look for a class named `EmailProcessor`. The class is
|
69
|
+
By default Griddler will look for a class named `EmailProcessor`. The class is
|
70
70
|
initialized with a `Griddler::Email` instance representing the incoming
|
71
71
|
email, and has a `process` method to actually process the email.
|
72
72
|
For example, in `./lib/email_processor.rb`:
|
@@ -100,7 +100,7 @@ Griddler::Email attributes
|
|
100
100
|
| `#from` | A hash containing the sender address information.
|
101
101
|
| `#cc` | An array of hashes containing cc email address information.
|
102
102
|
| `#subject` | The subject of the email message.
|
103
|
-
| `#body` | The full contents of the email body **unless** there is a line in the email containing the string `--
|
103
|
+
| `#body` | The full contents of the email body **unless** there is a line in the email containing the string `-- REPLY ABOVE THIS LINE --`. In that case `.body` will contain everything before that line.
|
104
104
|
| `#raw_text` | The raw text part of the body.
|
105
105
|
| `#raw_html` | The raw html part of the body.
|
106
106
|
| `#raw_body` | The raw body information provided by the email service.
|
@@ -11,6 +11,8 @@ class Griddler::EmailsController < ActionController::Base
|
|
11
11
|
|
12
12
|
delegate :processor_class, :processor_method, :email_service, to: :griddler_configuration
|
13
13
|
|
14
|
+
private :processor_class, :processor_method, :email_service
|
15
|
+
|
14
16
|
def normalized_params
|
15
17
|
Array.wrap(email_service.normalize_params(params))
|
16
18
|
end
|
data/lib/griddler/email.rb
CHANGED
@@ -11,7 +11,7 @@ module Griddler
|
|
11
11
|
|
12
12
|
@to = recipients(:to)
|
13
13
|
@from = extract_address(params[:from])
|
14
|
-
@subject =
|
14
|
+
@subject = extract_subject
|
15
15
|
|
16
16
|
@body = extract_body
|
17
17
|
@raw_text = params[:text]
|
@@ -37,13 +37,19 @@ module Griddler
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def recipients(type)
|
40
|
-
params[type].to_a.map
|
40
|
+
params[type].to_a.reject(&:empty?).map do |recipient|
|
41
|
+
extract_address(recipient)
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def extract_address(address)
|
44
46
|
EmailParser.parse_address(clean_text(address))
|
45
47
|
end
|
46
48
|
|
49
|
+
def extract_subject
|
50
|
+
clean_text(params[:subject])
|
51
|
+
end
|
52
|
+
|
47
53
|
def extract_body
|
48
54
|
EmailParser.extract_reply_body(text_or_sanitized_html)
|
49
55
|
end
|
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.3.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: 2016-02-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.5.1
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: SendGrid Parse API client Rails Engine
|