Class: Invitation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Invitation
- Defined in:
- app/models/invitation.rb
Overview
Represents an invitation from a member of one organization to another user
Instance Attribute Summary collapse
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
Instance Method Summary collapse
-
#organization_title ⇒ String
Identifies the organization that sent this invitation.
- #redeem! ⇒ Object
-
#redeemed? ⇒ Boolean
If this invitation has been redeemed.
- #role_rank ⇒ Object
-
#sender_name ⇒ String
Identifies the user who sent this invitation.
Instance Attribute Details
#first_name ⇒ Object
Returns the value of attribute first_name
36 37 38 |
# File 'app/models/invitation.rb', line 36 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name
37 38 39 |
# File 'app/models/invitation.rb', line 37 def last_name @last_name end |
Instance Method Details
#organization_title ⇒ String
Returns identifies the organization that sent this invitation
61 62 63 |
# File 'app/models/invitation.rb', line 61 def organization_title organization.title end |
#redeem! ⇒ Object
44 45 46 47 |
# File 'app/models/invitation.rb', line 44 def redeem! raise Coyote::SecurityError, "that token has already been used" if redeemed? update_attributes!(redeemed_at: Time.now) end |
#redeemed? ⇒ Boolean
Returns if this invitation has been redeemed
50 51 52 |
# File 'app/models/invitation.rb', line 50 def redeemed? !!redeemed_at end |
#role_rank ⇒ Object
39 40 41 |
# File 'app/models/invitation.rb', line 39 def role_rank Coyote::Membership.role_rank(role) end |
#sender_name ⇒ String
Returns identifies the user who sent this invitation
56 57 58 |
# File 'app/models/invitation.rb', line 56 def sender_name sender_user.to_s end |