Skip to content

Commit

Permalink
Complete gem update from Griddler::Ses to Griddler::AmazonSES (#2)
Browse files Browse the repository at this point in the history
* Fix test suite.

* Rename from Griddler::Ses to Griddler::AmazonSES.

* Update last references from Ses to AmazonSES.

* Bump version to 2.0.0.
  • Loading branch information
ccallebs authored Aug 29, 2018
1 parent 7ffea9f commit d09e921
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 40 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in griddler-ses.gemspec
gemspec
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Griddler::Ses
# Griddler::AmazonSES

This is a [Griddler](https://github.com/thoughtbot/griddler) adapter that allows you to parse email replies when used with Amazon SES.

Expand All @@ -9,7 +9,7 @@ Add these lines to your application's Gemfile:

```ruby
gem 'griddler'
gem 'griddler-ses'
gem 'griddler-amazon_ses'
```

And then execute:
Expand All @@ -29,7 +29,7 @@ And then execute:

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/85x14/griddler-ses.
Bug reports and pull requests are welcome on GitHub at https://github.com/ccallebs/griddler-amazon_ses.


## License
Expand Down
12 changes: 6 additions & 6 deletions griddler-ses.gemspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'griddler/ses/version'
require 'griddler/amazon_ses/version'

Gem::Specification.new do |spec|
spec.name = "griddler-ses"
spec.version = Griddler::Ses::VERSION
spec.authors = ["Kent Mewhort @ Coupa"]
spec.email = ["[email protected]"]
spec.name = "griddler-amazon_ses"
spec.version = Griddler::AmazonSES::VERSION
spec.authors = ["Chuck Callebs", "Kent Mewhort @ Coupa"]
spec.email = ["[email protected]", "[email protected]"]

spec.summary = %q{Griddler adapter for AWS SES (handle incoming email replies through SES)}
spec.homepage = "https://github.com/85x14/griddler-ses"
spec.homepage = "https://github.com/ccallebs/griddler-amazon_ses"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Expand Down
13 changes: 13 additions & 0 deletions lib/griddler/amazon_ses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'aws/sns_message'
require 'griddler'
require 'griddler/amazon_ses/version'
require 'griddler/amazon_ses/adapter'
require 'griddler/amazon_ses/middleware'
require 'griddler/amazon_ses/railtie'

module Griddler
module AmazonSES
end
end

Griddler.adapter_registry.register(:amazon_ses, Griddler::AmazonSES::Adapter)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'net/http'

module Griddler
module Ses
module AmazonSES
class Adapter
attr_reader :sns_json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Griddler
module Ses
module AmazonSES
class Middleware
def initialize(app)
@app = app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require 'rails/version'

module Griddler
module Ses
module AmazonSES
class Railtie < Rails::Railtie
if Rails::VERSION::MAJOR < 5
middleware = ActionDispatch::ParamsParser
Expand Down
5 changes: 5 additions & 0 deletions lib/griddler/amazon_ses/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Griddler
module AmazonSES
VERSION = "2.0.0"
end
end
13 changes: 0 additions & 13 deletions lib/griddler/ses.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/griddler/ses/version.rb

This file was deleted.

16 changes: 8 additions & 8 deletions spec/griddler/ses_spec.rb → spec/griddler/amazon_ses_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'spec_helper'

describe Griddler::Ses::Adapter do
describe Griddler::AmazonSES::Adapter do
before do
# mock the hash check on the notification, as we've zero'd the numbers
allow_any_instance_of(AWS::SnsMessage).to receive(:authentic?).and_return(true)
end

it 'registers itself with griddler' do
Griddler.adapter_registry[:ses].should eq Griddler::Ses::Adapter
expect(Griddler.adapter_registry[:amazon_ses]).to eq Griddler::AmazonSES::Adapter
end

describe "Griddler shared examples" do
Expand All @@ -16,27 +16,27 @@
sns_message[:mail][:commonHeaders][:cc] = ['[email protected]']
sns_message[:mail][:commonHeaders][:from] = ['There <[email protected]>']

allow_any_instance_of(Griddler::Ses::Adapter).to receive(:sns_json).and_return(default_params)
allow_any_instance_of(Griddler::AmazonSES::Adapter).to receive(:sns_json).and_return(default_params)
end

it_behaves_like 'Griddler adapter', :ses, {}
it_behaves_like 'Griddler adapter', :amazon_ses, {}
end

describe '.normalize_params' do
it 'parses out the "to" addresses, returning an array' do
expect(Griddler::Ses::Adapter.normalize_params(default_params)[:to]).to eq ['"Mr Fugushima at Fugu, Inc" <[email protected]>', 'Foo bar <[email protected]>']
expect(Griddler::AmazonSES::Adapter.normalize_params(default_params)[:to]).to eq ['"Mr Fugushima at Fugu, Inc" <[email protected]>', 'Foo bar <[email protected]>']
end

it 'parses out the "from" address, returning a string' do
expect(Griddler::Ses::Adapter.normalize_params(default_params)[:from]).to eq "Test There <[email protected]>"
expect(Griddler::AmazonSES::Adapter.normalize_params(default_params)[:from]).to eq "Test There <[email protected]>"
end

it 'parses out the "subject", returning a string' do
expect(Griddler::Ses::Adapter.normalize_params(default_params)[:subject]).to eq "Test"
expect(Griddler::AmazonSES::Adapter.normalize_params(default_params)[:subject]).to eq "Test"
end

it 'parses out the text' do
expect(Griddler::Ses::Adapter.normalize_params(default_params)[:text]).to eq "Hi\n"
expect(Griddler::AmazonSES::Adapter.normalize_params(default_params)[:text]).to eq "Hi\n"
end
end

Expand Down
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'griddler'
require 'griddler/testing'
require 'griddler/ses'
require 'griddler/amazon_ses'
require 'rails/version'
require 'action_dispatch'

RSpec.configure do |config|
Expand Down

0 comments on commit d09e921

Please sign in to comment.