Sha256: 0909b744b7ea1137907e2f849b7d33307250f44e25b027ee1231ae8ddc1a0142
Contents?: true
Size: 1.52 KB
Versions: 7
Compression:
Stored size: 1.52 KB
Contents
# == Schema Information # # Endpoint: # - /v1/org_invites # - /v1/organizations/:organization_id/org_invites # # id :integer not null, primary key # user_id :integer # user_email :string(255) # organization_id :integer # referrer_id :integer # token :string(255) # status :string(255) # created_at :datetime not null # updated_at :datetime not null # user_role :string(255) # team_id :integer # module MnoEnterprise class OrgInvite < BaseResource scope :active, -> { where(status: 'pending') } scope :active_or_staged, -> { where('status.in' => %w(staged pending)) } #============================================================== # Associations #============================================================== belongs_to :user, class_name: 'MnoEnterprise::User' belongs_to :referrer, class_name: 'MnoEnterprise::User' belongs_to :organization, class_name: 'MnoEnterprise::Organization' belongs_to :team, class_name: 'MnoEnterprise::Team' # TODO: specs # Add the user to the organization and update the status of the invite # Add team def accept!(user = self.user) self.put(operation: 'accept', data: { user_id: user.id}) end # TODO: specs def cancel! self.put(operation: 'cancel') end # TODO: specs # Check whether the invite is expired or not def expired? self.status != 'pending' || self.created_at < 3.days.ago end end end
Version data entries
7 entries across 7 versions & 1 rubygems