module Fraternity

Constants

VERSION

Public Class Methods

bid!(quota) click to toggle source
# File lib/fraternity.rb, line 37
def self.bid!(quota)
  Repositories::PledgeRepository.oldest_uninvited_by_initiation_number(quota).collect do |pledge|
    pledge.bid!
  end
end
configuration() click to toggle source
# File lib/fraternity.rb, line 11
def self.configuration
  @configuration ||= Fraternity::Configuration.new
end
configure(initiate=true) { |configuration| ... } click to toggle source
# File lib/fraternity.rb, line 15
def self.configure(initiate=true)
  yield configuration if block_given?
  Repositories.initiation! configuration.database_url if initiate
end
find(identifier) click to toggle source
# File lib/fraternity.rb, line 43
def self.find(identifier)
  if identifier.is_a? Integer
    return Repositories::PledgeRepository.find_by_id identifier
  end
  Repositories::PledgeRepository.find_by_token identifier
end
rush(params={}) click to toggle source
# File lib/fraternity.rb, line 20
def self.rush(params={})
  pledge = Repositories::PledgeRepository.find_by_email params[:email]
  if pledge
    pledge.merge params
  else
    params[:token] ||= TemporaryToken.generate_random_token
    params[:initiation_number] ||= Time.now.to_i
    pledge = Fraternity::Pledge.new params
  end
  configuration.receive_pledge.call pledge
  pledge
end
rush!(params) click to toggle source
# File lib/fraternity.rb, line 33
def self.rush!(params)
  Repositories::PledgeRepository.persist self.rush(params)
end