-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ok, SendGrid, we'll do it your way. (#289)
- Loading branch information
1 parent
24cfe27
commit ad399da
Showing
9 changed files
with
133 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,5 @@ | |
|
||
.env | ||
private/ | ||
|
||
/config/master.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ApplicationMailbox < ActionMailbox::Base | ||
routing :all => :incomings | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class IncomingsMailbox < ApplicationMailbox | ||
def process | ||
mail_attachments | ||
end | ||
|
||
def mail_body | ||
mail.body.decoded | ||
end | ||
|
||
def mail_attachments | ||
mail.mail_attachments.each do |attachment| | ||
# your logic here | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hlOhSyqh0KJoerA3ojBSyGK+uHvPMsisouAb9oRiX3GllB/R7F4gQjX0+Ipu/ixFRTMYdEl9biq+ZQt9y+4dUsfqzuMjfVkJp2aP8AjZO/3Rc7msUw67V3GLBLWFOdOgIk7to04Ta0OcJCDoqiNj/A1XHCLCdUCfe3E/UKp5XiStCocyvJexri/v4D3TmnvJVUjORdmIAI/8//vK9ElAxBvqLTWHKRWup2VUdqIHd+aelOtur2dHLJ6YO6LUMYSony5T4ubU2FUo1VnSeJU1jTiTPna8fegjhSUQPIrU2gQjdseljXiMhrlyL4y/42hLua/vVHydWACToj1rV3qYXZXg/Zh13rwyZSo2aip8nzJ9OTthihfx7aTsBTXPCxmPxImxSvHbYvBLqO5WIEIvLgf4yZUcFCBZ2cEZwgLn7ZnofRlkluzZxUkGqH0A--WeC7nRLgdXv4ar+D--HTpMvy6AYOiOGdTTfQNtTw== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
db/migrate/20230726012825_create_active_storage_tables.active_storage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This migration comes from active_storage (originally 20170806125915) | ||
class CreateActiveStorageTables < ActiveRecord::Migration[5.2] | ||
def change | ||
# Use Active Record's configured type for primary and foreign keys | ||
primary_key_type, foreign_key_type = primary_and_foreign_key_types | ||
|
||
create_table :active_storage_blobs, id: primary_key_type do |t| | ||
t.string :key, null: false | ||
t.string :filename, null: false | ||
t.string :content_type | ||
t.text :metadata | ||
t.string :service_name, null: false | ||
t.bigint :byte_size, null: false | ||
t.string :checksum, null: false | ||
t.datetime :created_at, null: false | ||
|
||
t.index [ :key ], unique: true | ||
end | ||
|
||
create_table :active_storage_attachments, id: primary_key_type do |t| | ||
t.string :name, null: false | ||
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type | ||
t.references :blob, null: false, type: foreign_key_type | ||
|
||
t.datetime :created_at, null: false | ||
|
||
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true | ||
t.foreign_key :active_storage_blobs, column: :blob_id | ||
end | ||
|
||
create_table :active_storage_variant_records, id: primary_key_type do |t| | ||
t.belongs_to :blob, null: false, index: false, type: foreign_key_type | ||
t.string :variation_digest, null: false | ||
|
||
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true | ||
t.foreign_key :active_storage_blobs, column: :blob_id | ||
end | ||
end | ||
|
||
private | ||
def primary_and_foreign_key_types | ||
config = Rails.configuration.generators | ||
setting = config.options[config.orm][:primary_key_type] | ||
primary_key_type = setting || :primary_key | ||
foreign_key_type = setting || :bigint | ||
[primary_key_type, foreign_key_type] | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
db/migrate/20230726012826_create_action_mailbox_tables.action_mailbox.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This migration comes from action_mailbox (originally 20180917164000) | ||
class CreateActionMailboxTables < ActiveRecord::Migration[6.0] | ||
def change | ||
create_table :action_mailbox_inbound_emails do |t| | ||
t.integer :status, default: 0, null: false | ||
t.string :message_id, null: false | ||
t.string :message_checksum, null: false | ||
|
||
t.timestamps | ||
|
||
t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe IncomingsMailbox, type: :mailbox do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |