griddler 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4163676a81c7d1daa49b40040fb2078c17bcc5f4
4
- data.tar.gz: 4e2e62835388a98d6760e7f98b7f71a598e8fb51
3
+ metadata.gz: 6aa1ca112493637de599c4d500d4f7866bf6f9d2
4
+ data.tar.gz: 7982ae7c23c1c5166afc18666804087feedebe7c
5
5
  SHA512:
6
- metadata.gz: c55df130df4369efbfdbde629bc9acb8a87297cc183a2344263afef909c06bf568bc6809279275beb7137c98f5851ccdac9e1ed444ce46860b6bca906c05cd0c
7
- data.tar.gz: a49562fba84daabee4c201ed85eacaafb3016c202d2edd22f8dd4f722405c1132cb17e3068dbc205b753cb5b06291858f2d2295c7bf1d51591f699436894ebf3
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](http://robots.thoughtbot.com/handle-incoming-email-with-griddler).
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 `-- Reply ABOVE THIS LINE --`. In that case `.body` will contain everything before that line.
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
@@ -44,7 +44,7 @@ module Griddler
44
44
  end
45
45
 
46
46
  def reply_delimiter
47
- @reply_delimiter ||= 'Reply ABOVE THIS LINE'
47
+ @reply_delimiter ||= '-- REPLY ABOVE THIS LINE --'
48
48
  end
49
49
 
50
50
  def email_service
@@ -11,7 +11,7 @@ module Griddler
11
11
 
12
12
  @to = recipients(:to)
13
13
  @from = extract_address(params[:from])
14
- @subject = params[: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 { |recipient| extract_address(recipient) }
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
@@ -1,3 +1,3 @@
1
1
  module Griddler
2
- VERSION = "1.2.1"
2
+ VERSION = '1.3.0'
3
3
  end
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.2.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: 2015-07-09 00:00:00.000000000 Z
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.4.8
144
+ rubygems_version: 2.5.1
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: SendGrid Parse API client Rails Engine