Class: EmailInviter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(emails, inviter, options = {}) ⇒ EmailInviter


4
5
6
7
8
9
10
# File 'lib/email_inviter.rb', line 4

def initialize(emails, inviter, options={})
  options = options.symbolize_keys
  self.message = options[:message]
  self.locale = options.fetch(:locale, 'en')
  self.inviter = inviter 
  self.emails = emails
end

Instance Attribute Details

#emailsObject

Returns the value of attribute emails


2
3
4
# File 'lib/email_inviter.rb', line 2

def emails
  @emails
end

#inviterObject

Returns the value of attribute inviter


2
3
4
# File 'lib/email_inviter.rb', line 2

def inviter
  @inviter
end

#localeObject

Returns the value of attribute locale


2
3
4
# File 'lib/email_inviter.rb', line 2

def locale
  @locale
end

#messageObject

Returns the value of attribute message


2
3
4
# File 'lib/email_inviter.rb', line 2

def message
  @message
end

Instance Method Details

#invitation_codeObject


18
19
20
# File 'lib/email_inviter.rb', line 18

def invitation_code
  @invitation_code ||= inviter.invitation_code 
end

#send!Object


22
23
24
# File 'lib/email_inviter.rb', line 22

def send!
  self.emails.each{ |email| mail(email)}
end