Class: MnoEnterprise::OrgInvite

Inherits:
BaseResource show all
Defined in:
app/models/mno_enterprise/org_invite.rb

Instance Method Summary collapse

Methods inherited from BaseResource

#==, base_class, #cache_key, #clear_association_cache, #clear_attribute_changes!, exists?, find_by, first, last, #max_updated_column_timestamp, #read_attribute, #reload, #save, #save!, #update, #write_attribute

Methods included from HerExtension::Validations::RemoteUniquenessValidation

included

Instance Method Details

#accept!(user = self.user) ⇒ Object

TODO: specs Add the user to the organization and update the status of the invite Add team



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

def accept!(user = self.user)
  self.put(operation: 'accept', data: { user_id: user.id})
end

#cancel!Object

TODO: specs



41
42
43
# File 'app/models/mno_enterprise/org_invite.rb', line 41

def cancel!
  self.put(operation: 'cancel')
end

#expired?Boolean

TODO: specs Check whether the invite is expired or not

Returns:

  • (Boolean)


47
48
49
# File 'app/models/mno_enterprise/org_invite.rb', line 47

def expired?
  self.status != 'pending' || self.created_at < 3.days.ago
end

#to_audit_eventObject



51
52
53
# File 'app/models/mno_enterprise/org_invite.rb', line 51

def to_audit_event
  self.attributes.slice(:team_id, :user_role, :user_email, :user_id, :referrer_id, :organization_id)
end