Class: PairingShuffler::Mailer

Inherits:
Object
  • Object
show all
Defined in:
lib/pairing_shuffler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Mailer

Returns a new instance of Mailer.



56
57
58
# File 'lib/pairing_shuffler.rb', line 56

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



54
55
56
# File 'lib/pairing_shuffler.rb', line 54

def config
  @config
end

Instance Method Details

#notify(emails) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pairing_shuffler.rb', line 69

def notify(emails)
  subject = "PairingShuffler winners"
  # 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 https://docs.google.com/spreadsheet/ccc?key=\#{config[:doc]}\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}/, "")

#sessionObject

Google returns 535-5.7.1 on to frequent auth -> only do it once



61
62
63
64
65
66
67
# File 'lib/pairing_shuffler.rb', line 61

def session
  @session = true
  yield self
ensure
  @session = false
  stop_smtp
end