griddler-acd 1.0.0 → 1.1.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: 0bbff6edeef08baf0c4cfc81727aef71984e8064
4
- data.tar.gz: e622fa41d89c7ca9513c0a21752b51d05a5f2b30
3
+ metadata.gz: 6f7dbbfbda592a0bcf80fe4df55045858c25d944
4
+ data.tar.gz: 911335e6918f74d77f55d759a99c59958a1b6eb4
5
5
  SHA512:
6
- metadata.gz: 20ee0b0ce115d5a9bb41e0f4e6084d0a187ca9249e4edf4f1713ccc1f5f2377479da328367249ce7cef6f1879e6ca8501f8e4e40e61944225ae06e766b007237
7
- data.tar.gz: 3cf2ede21b125530f4bd26d95b953842d02d2dc3428e21122d04b650a60399f050f149be7793a302d46b3b23d76d026a65f87e4f3b86b5744cc5237cdbd5d2ef
6
+ metadata.gz: c1e8558a793090d8afe246526016ceef5464dce70f9817c9787262e40fde7172b1c1a55901bb494acde8d14c9277b6d667ac6c6fb8c21e053c611c95a7961a55
7
+ data.tar.gz: ad7892041f4321d82444c467388136cdf9d44d20c21436dc94f9783ad07816f03e13c98b6a400a8b0e9214344d76ff3e10e7f4ae82a92e88579b356774adb12e
data/README.md CHANGED
@@ -66,9 +66,10 @@ 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` with a method
70
- named `process`, taking in one argument, a `Griddler::Email` instance
71
- representing the incoming email. For example, in `./lib/email_processor.rb`:
69
+ By default Griddler will look for a class named `EmailProcessor`. The class is
70
+ initialized with a `Griddler::Email` instance representing the incoming
71
+ email, and has a `process` method to actually process the email.
72
+ For example, in `./lib/email_processor.rb`:
72
73
 
73
74
  ```ruby
74
75
  class EmailProcessor
@@ -131,7 +132,7 @@ with the following sample factory:
131
132
  factory :email, class: OpenStruct do
132
133
  # Assumes Griddler.configure.to is :hash (default)
133
134
  to [{ full: 'to_user@email.com', email: 'to_user@email.com', token: 'to_user', host: 'email.com', name: nil }]
134
- from 'user@email.com'
135
+ from({ token: 'from_user', host: 'email.com', email: 'from_email@email.com', full: 'From User <from_user@email.com>', name: 'From User' })
135
136
  subject 'email subject'
136
137
  body 'Hello!'
137
138
  attachments {[]}
@@ -189,7 +190,7 @@ your adapter returns a hash with these keys:
189
190
  | `:from` | The sender field
190
191
  | `:subject` | Email subject
191
192
  | `:text` | The text body of the email
192
- | `:html` | The html body of the email, nil or empty string if not present
193
+ | `:html` | The html body of the email, or an empty string
193
194
  | `:attachments` | Array of attachments to the email. Can be an empty array.
194
195
  | `:headers` | The raw headers of the email. **Optional**.
195
196
  | `:charsets` | A JSON string containing the character sets of the fields extracted from the message. **Optional**.
@@ -22,7 +22,7 @@ module Griddler
22
22
  @processor_class ||=
23
23
  begin
24
24
  if Kernel.const_defined?(:EmailProcessor)
25
- EmailProcessor
25
+ "EmailProcessor"
26
26
  else
27
27
  raise NameError.new(<<-ERROR.strip_heredoc, 'EmailProcessor')
28
28
  To use Griddler, you must either define `EmailProcessor` or configure a
@@ -31,6 +31,12 @@ module Griddler
31
31
  ERROR
32
32
  end
33
33
  end
34
+
35
+ @processor_class.constantize
36
+ end
37
+
38
+ def processor_class=(klass)
39
+ @processor_class = klass.to_s
34
40
  end
35
41
 
36
42
  def processor_method
@@ -3,7 +3,7 @@ require 'htmlentities'
3
3
  module Griddler
4
4
  class Email
5
5
  include ActionView::Helpers::SanitizeHelper
6
- attr_reader :to, :from, :cc, :subject, :body, :raw_body, :raw_text, :raw_html,
6
+ attr_reader :to, :from, :cc, :bcc, :subject, :body, :raw_body, :raw_text, :raw_html,
7
7
  :headers, :raw_headers, :attachments
8
8
 
9
9
  def initialize(params)
@@ -21,6 +21,7 @@ module Griddler
21
21
  @headers = extract_headers
22
22
 
23
23
  @cc = recipients(:cc)
24
+ @bcc = recipients(:bcc)
24
25
 
25
26
  @raw_headers = params[:headers]
26
27
 
@@ -76,7 +76,7 @@ module Griddler::EmailParser
76
76
  reply_delimeter_regex,
77
77
  /^\s*[-]+\s*Original Message\s*[-]+\s*$/i,
78
78
  /^\s*--\s*$/,
79
- /^\s*\>?\s*On.*\r?\n?\s*.*\s*wrote:\r?\n?$/,
79
+ /^\s*\>?\s*On.*\r?\n?.*wrote:\r?\n?$/,
80
80
  /On.*wrote:/,
81
81
  /From:.*$/i,
82
82
  /^\s*\d{4}\/\d{1,2}\/\d{1,2}\s.*\s<.*>?$/i
@@ -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 expect(actual[k]).to =~ v
85
- else expect(actual[k]).to === v
84
+ when Regexp then expect(actual[k]).to match(v)
85
+ else expect(actual[k]).to eq(v)
86
86
  end
87
87
  end
88
88
  end
@@ -1,3 +1,3 @@
1
1
  module Griddler
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: griddler-acd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2014-08-20 00:00:00.000000000 Z
14
+ date: 2015-03-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: htmlentities
@@ -110,10 +110,7 @@ files:
110
110
  homepage: http://thoughtbot.com
111
111
  licenses: []
112
112
  metadata: {}
113
- post_install_message: |
114
- When upgrading from a Griddler version previous to 0.5.0, it is important that
115
- you view https://github.com/thoughtbot/griddler/#upgrading-to-griddler-050 for
116
- upgrade information.
113
+ post_install_message:
117
114
  rdoc_options: []
118
115
  require_paths:
119
116
  - app
@@ -130,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
127
  version: '0'
131
128
  requirements: []
132
129
  rubyforge_project:
133
- rubygems_version: 2.3.0
130
+ rubygems_version: 2.4.3
134
131
  signing_key:
135
132
  specification_version: 4
136
133
  summary: SendGrid Parse API client Rails Engine
137
134
  test_files: []
138
- has_rdoc: