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!, 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



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

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

#cancel!Object

TODO: specs



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

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

#expired?Boolean

TODO: specs Check whether the invite is expired or not

Returns:

  • (Boolean)


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

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