Class: Artisan::Notifications::Inviter
- Inherits:
-
Object
- Object
- Artisan::Notifications::Inviter
- Defined in:
- lib/artisan/notifications/inviter.rb
Constant Summary collapse
- EMAIL_REGEX =
/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
Instance Method Summary collapse
- #add_to_future_users(project) ⇒ Object
-
#initialize(name, email) ⇒ Inviter
constructor
A new instance of Inviter.
- #invite ⇒ Object
Constructor Details
#initialize(name, email) ⇒ Inviter
Returns a new instance of Inviter.
8 9 10 11 |
# File 'lib/artisan/notifications/inviter.rb', line 8 def initialize(name, email) @name = name @email = email end |
Instance Method Details
#add_to_future_users(project) ⇒ Object
21 22 23 |
# File 'lib/artisan/notifications/inviter.rb', line 21 def add_to_future_users(project) Artisan::Repository.future_user.create(:email => @email, :project_id => project.id) end |
#invite ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/artisan/notifications/inviter.rb', line 13 def invite if valid_name? && valid_email? mail_invite else raise "Name and email fields are required, please fill out all fields and try again." end end |