Class: SimpleTeams::Invitation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SimpleTeams::Invitation
- Defined in:
- app/models/simple_teams/invitation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #expired? ⇒ Boolean
- #resend_invitation_notification(options = {}) ⇒ Object
- #reset_invitation_token ⇒ Object
- #unexpired? ⇒ Boolean
Class Method Details
.expiration_window ⇒ Object
48 49 50 |
# File 'app/models/simple_teams/invitation.rb', line 48 def self.expiration_window 2.weeks end |
Instance Method Details
#expired? ⇒ Boolean
27 28 29 |
# File 'app/models/simple_teams/invitation.rb', line 27 def expired? Time.now > expires_at end |
#resend_invitation_notification(options = {}) ⇒ Object
41 42 43 44 45 46 |
# File 'app/models/simple_teams/invitation.rb', line 41 def resend_invitation_notification( = {}) if Time.now > expires_at - self.class.expiration_window + 1.day reset_invitation_token end send_invitation_notification() end |
#reset_invitation_token ⇒ Object
35 36 37 38 39 |
# File 'app/models/simple_teams/invitation.rb', line 35 def reset_invitation_token generate_token set_expires_at self.save end |
#unexpired? ⇒ Boolean
31 32 33 |
# File 'app/models/simple_teams/invitation.rb', line 31 def unexpired? Time.now <= expires_at end |