Commit afa9b9c

mo khan <mo@mokhan.ca>
2015-11-14 05:24:29
spike out griddler.
1 parent 186b641
Changed files (5)
app/models/email_processor.rb
@@ -0,0 +1,9 @@
+class EmailProcessor
+  def initialize(email)
+    @email = email
+  end
+
+  def process
+    Rails.logger.info(@email.inspect)
+  end
+end
config/initializers/griddler.rb
@@ -0,0 +1,6 @@
+Griddler.configure do |config|
+  config.processor_class = EmailProcessor
+  config.processor_method = :process
+  config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
+  config.email_service = :mandrill
+end
config/routes.rb
@@ -13,4 +13,7 @@ Rails.application.routes.draw do
   get "/u/:id" => "profiles#show", constraints: { id: /[^\/]+/ }
   get "/dashboard" => "training_sessions#index", as: :dashboard
   get "/terms" => "static_pages#terms"
+
+  get "/email/incoming", to: proc { [200, {}, ["OK"]] }, as: "mandrill_head_test_request"
+  post "/email/incoming" => "griddler/emails#create"
 end
Gemfile
@@ -43,6 +43,8 @@ gem 'rubyzip', require: "zip"
 gem 'font-awesome-rails'
 gem 'ractive-rails'
 gem 'sidekiq'
+gem 'griddler'
+gem 'griddler-mandrill'
 
 source 'https://rails-assets.org' do
   gem 'rails-assets-ractive'
Gemfile.lock
@@ -137,10 +137,16 @@ GEM
       sass (>= 3.3.0, < 3.5)
     globalid (0.3.5)
       activesupport (>= 4.1.0)
+    griddler (1.2.1)
+      htmlentities
+      rails (>= 3.2.0)
+    griddler-mandrill (1.1.3)
+      griddler (>= 1.2.1)
     groupdate (2.4.0)
       activesupport (>= 3)
     highline (1.7.2)
     hitimes (1.2.2)
+    htmlentities (4.3.4)
     http-cookie (1.0.2)
       domain_name (~> 0.5)
     i18n (0.7.0)
@@ -379,6 +385,8 @@ DEPENDENCIES
   font-awesome-rails
   foreman
   foundation-rails
+  griddler
+  griddler-mandrill
   groupdate
   i18n-tasks
   jbuilder (~> 2.0)