Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails 6.0 Action Mailboxについて
Search
horikawa
May 15, 2019
Programming
0
370
Rails 6.0 Action Mailboxについて
otemachi.rb#17で発表した資料
horikawa
May 15, 2019
Tweet
Share
More Decks by horikawa
See All by horikawa
Caching associations in rails
casix
1
320
Create Action Mailbox Sample Application
casix
1
340
Rails 4.2→5.2アップデート
casix
0
380
Other Decks in Programming
See All in Programming
受け取る人から提供する人になるということ
little_rubyist
0
250
みんなでプロポーザルを書いてみた
yuriko1211
0
280
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
3
140
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
RubyLSPのマルチバイト文字対応
notfounds
0
120
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
CSC509 Lecture 11
javiergs
PRO
0
180
Jakarta EE meets AI
ivargrimstad
0
170
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
A Philosophy of Restraint
colly
203
16k
Writing Fast Ruby
sferik
627
61k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Happy Clients
brianwarren
98
6.7k
It's Worth the Effort
3n
183
27k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Transcript
Rails 6.0ͷ Action Mailbox גࣜձࣾπΫϧόɹαʔόαΠυΤϯδχΞ ງɹ@CASIXx1
• ීஈʮcowcamoʯͱ͍͏ΞϓϦΛ։ൃͯ͠ ·͢ • αʔόαΠυɺRailsʢ5.2ʣΛͬͯ·͢
Rails 6.0.0͕ͦΖͦΖग़ͦ͏ʂ
Rails 6.0.0.rc1͕ग़͍ͯΔͷ Ͱɺ΄΅6.0ͷػೳࢼͤΔʂ
৭ʑՃ͞Ε͍ͯΔ
Rails 6.0ͷओཁՃػೳ • Action Text • Action Mailbox • Multiple
Databases • Parallel Testing • Zeitwerk...etc
Action Textͷ ฉ͚͘Ͳɺɺ
Action Mailboxͷฉ͔ͳ͍...
Action Mailboxͷ͜ͱΛ ௐͯΈ·ͨ͠ ʢ·్ͩத·Ͱ͔͠ ࢼͤͯͳ͍ ʣ
ݩʑɺผͷgemͱ࣮ͯ͠͞Ε ͍ͯͨ
Rails 5.2Ͱ͑ͦ͏???
Action Mailboxͷػೳ • ड৴ϝʔϧʹରͯ͠ɺʮRailsʯͰɺॲཧ͢Δʂ • DBS3ʹอଘͨ͠ΓɺAction MailerΛͬͯɺ ࣗಈฦ৴ͨ͠Γ…
4FOE(SJE Ϣʔβʔ ϝʔϧૹ৴ RailsʹHTTP Post ɹ3BJMT "DUJPO.BJMCPY ॲཧ %# อଘ
4
ॳظઃఆ • $ rails action_mailbox:install • ApplicationMailboxΫϥε͕ੜ͞ΕΔ • MailboxΛ֨ೲ͢Δςʔϒϧ͕ੜ͞ΕΔ
app/mailboxes/application_mailbox.rb class ApplicationMailbox < ActionMailbox::Base #
[email protected]
Ѽͷϝʔϧ # ForwardsMailboxΫϥεͰɺॲཧΛߦ͏ routing
/^save@/i => :forwards #
[email protected]
Ѽͷϝʔϧ # RepliesMailboxΫϥεͰɺॲཧΛߦ͏ routing /@replies\./i => :replies end
ϝʔϧɺInboundEmailϞσ ϧͱͯ͠ѻΘΕΔ • class InboundEmail < ActiveRecord::Base • https://github.com/rails/rails/blob/ master/actionmailbox/app/models/
action_mailbox/inbound_email.rb • ActiveStorageͱࣅͨΑ͏ͳײ͡??
SMTPड͚ೖΕઃఆ • config/environments/֤ڥ.rb config.action_mailbox.ingress = # ͜͜ʹαʔϏε໊ # sendgridͷ߹ config.action_mailbox.ingress
= :sendgrid # mailgunͷ߹ config.action_mailbox.ingress = :mailgun # exam, mailgun, mandrill, postfix, postmark, qmail, sendgridΛαϙʔτ͍ͯ͠Δ
ύεϫʔυઃఆ • SendGridͳͲͷϝʔϧαʔϏεͱͷ࿈ܞͰɺ ύεϫʔυ͕ٻΊΒΕΔͷͰɺ ڥม or CredentialͰύεϫʔυΛ RailsଆͰઃఆ͓ͯ͘͠
ϝʔϧαʔϏεଆͷઃఆ ྫɿSendGrid SendGrid͔ΒɺHTTP POSTͯ͠Β͏ʂ https://actionmailbox:password@domain/rails/ action_mailbox/sendgrid/inbound_emails
ศརͳҹ • RspecͳͲͰͷςετॻ͚Δ • ActiveStorageΛ͑ɺS3ͳͲʹอଘͰ͖ΔΒ͠ ͍ • Callbackग़དྷͦ͏ • https://github.com/rails/rails/blob/master/
actionmailbox/lib/action_mailbox/callbacks.rb
ؾʹͳͬͨՕॴ • ϝʔϧαʔϏεଆͷઃఆඞཁʹͳΔ • SendGridͳΒɺInbound ParseͳͲ • Parseͷ༷ཧղ͓͔ͯ͠ͳ͍ͱ͍͚ͳ͍ • SESɺRails
6.1͔ΒͷαϙʔτͱͳΓͦ͏ • https://github.com/rails/rails/commit/ f480cfabcd9000b5817b610e21466299025b12d2 • ެࣜඇެࣜͷυΩϡϝϯτ͕ඇৗʹগͳ͍… • ϝʔϧେྔʹདྷͨΒɺαʔόͲ͏ͳΔͷ͔ͳ…
·ͱΊ
·ͱΊ • Rails AppͰ࿈ܞ͕ඞཁͳ߹ɺॏๅͦ͠ ͏ʂ • ֤ཧऀʹϝʔϧΛసૹͨ͠Γ • ࿈ܞ͕ཁΒͳ͍߹ɺAction Mailbox୯ମ
ͰαʔόཱͯΕྑ͍ؾ…
ऴΘΓ
ࢀߟ • Action Mailbox gem • https://github.com/rails/actionmailbox/tree/master • Rails Guides
• https://edgeguides.rubyonrails.org/ action_mailbox_basics.html • bagelee • https://bagelee.com/programming/ruby-on-rails/rails6- action-mailbox/