griddler-acd 1.0.0 → 1.1.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 +6 -5
 - data/lib/griddler/configuration.rb +7 -1
 - data/lib/griddler/email.rb +2 -1
 - data/lib/griddler/email_parser.rb +1 -1
 - data/lib/griddler/testing.rb +2 -2
 - data/lib/griddler/version.rb +1 -1
 - metadata +4 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6f7dbbfbda592a0bcf80fe4df55045858c25d944
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 911335e6918f74d77f55d759a99c59958a1b6eb4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 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 ' 
     | 
| 
      
 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,  
     | 
| 
      
 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
         
     | 
    
        data/lib/griddler/email.rb
    CHANGED
    
    | 
         @@ -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 
     | 
| 
      
 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
         
     | 
    
        data/lib/griddler/testing.rb
    CHANGED
    
    | 
         @@ -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  
     | 
| 
       85 
     | 
    
         
            -
                  else expect(actual[k]).to  
     | 
| 
      
 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
         
     | 
    
        data/lib/griddler/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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:  
     | 
| 
      
 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 
     | 
| 
      
 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: 
         
     |