Class: Invitation

Inherits:
ApplicationRecord show all
Defined in:
app/models/invitation.rb

Overview

Represents an invitation from a member of one organization to another user

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#first_nameObject

Returns the value of attribute first_name



36
37
38
# File 'app/models/invitation.rb', line 36

def first_name
  @first_name
end

#last_nameObject

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_titleString

Returns identifies the organization that sent this invitation

Returns:

  • (String)

    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

Returns:

  • (Boolean)

    if this invitation has been redeemed



50
51
52
# File 'app/models/invitation.rb', line 50

def redeemed?
  !!redeemed_at
end

#role_rankObject



39
40
41
# File 'app/models/invitation.rb', line 39

def role_rank
  Coyote::Membership.role_rank(role)
end

#sender_nameString

Returns identifies the user who sent this invitation

Returns:

  • (String)

    identifies the user who sent this invitation

See Also:



56
57
58
# File 'app/models/invitation.rb', line 56

def sender_name
  sender_user.to_s
end