Class: PairingShuffler::Mailer
- Inherits:
-
Object
- Object
- PairingShuffler::Mailer
- Defined in:
- lib/pairing_shuffler.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Mailer
constructor
A new instance of Mailer.
- #notify(emails) ⇒ Object
-
#session ⇒ Object
Google returns 535-5.7.1 on to frequent auth -> only do it once.
Constructor Details
#initialize(config) ⇒ Mailer
Returns a new instance of Mailer.
60 61 62 |
# File 'lib/pairing_shuffler.rb', line 60 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
58 59 60 |
# File 'lib/pairing_shuffler.rb', line 58 def config @config end |
Instance Method Details
#notify(emails) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/pairing_shuffler.rb', line 73 def notify(emails) subject = "PairingShuffler winners" url = config[:short] || "https://docs.google.com/spreadsheet/ccc?key=#{config[:doc]}" # FYI: if the first line is a url the email is blank in gmail body = " Hello \#{emails.map{|e|e.sub(/@.*/,\"\")}.join(\" & \")}!\n\n You both singed up for PairingShuffler at \#{url}\n so let's pair!\n\n Tips:\n - Talk out loud & explain: what are you thinking / what are you going to do\n - Avoid keyboard fights: use 2 keyboards + 2 mice\n - Ping pong with tests: A writes tests, B writes implementation\n - Invite others to sign up for pairing\n\n Greetings,\n PairingShuffler\n MAIL\n send_email(emails, :subject => subject, :body => body)\nend\n".gsub(/^ {8}/, "") |
#session ⇒ Object
Google returns 535-5.7.1 on to frequent auth -> only do it once
65 66 67 68 69 70 71 |
# File 'lib/pairing_shuffler.rb', line 65 def session @session = true yield self ensure @session = false stop_smtp end |