Fraternity
DESCRIPTION
An easier way to rush for a beta.
A gem allows you to collect and store (using only the Lotus framework as of now) a list of pledges who would like access to your beta. You can send out bids to those pledges and allow them to gain access to your beta.
INSTALLATION
Add this line to your Gemfile:
gem 'fraternity'
And then execute:
bundle install
Or install it yourself:
gem install fraternity
Create the database table needed:
Coming soon
fraternity install "db/migrate"
The above will create the following table.
create_table :pledges do |t|
t.primary_key :id
String :token
String :email
String :first_name
String :last_name
Integer :initiation_number
DateTime :invited_at
DateTime :accepted_at
end
USAGE
If you are unfamiliar with the terminology, you can read up at http://www.unlv.edu/getinvolved/greek-definitions.
Configuring
In order to use your Fraternity, you have to configure it before you use it.
Fraternity.configure do |config|
configure.database_url = ENV["DATABASE_URL"]
configure.send_invite = lambda do |pledge|
BetaMailer.invite_email(pledge).deliver
end
config.receive_pledge = lambda do |pledge|
AdminMailer.new_pledge_email(pledge).deliver
end
end
Pledging
To sign up pledges, you first need to rush. Collect email addresses (and any additional information) to get in line for membership at the frat house.
params = { email: "jeremy.piven@example.com" } # Optional attributes you want to save such as first_name, last_name, etc.
pledge = Fraternity.rush! params
The above saves the information to the pledges database and creates a token for a Pledge
. It calls the receive_pledge
hook with the new Pledge
instance that is defined in the configuration.
Moving up the initiation line
Coming soon
Inviting a new pledge
Send out email invitations to the next set of pledges based on their initiation number. A quota is specified for the number you want to invite.
invited = Fraternity.bid! quota
The above saves the date/time of the invite to all the invited pledges and returns an array of the invited.
The above will also call the send_invite
proc that you have set up in the configuration. You are responsible for sending the invite to the pledge any way you like.
Find out if a pledge has been invited
Fraternity::Pledge.find(123).invited?
Resend an invite
Fraternity::Pledge.find(123).bid!
Accepting a pledge
Check to see if a pledge is ready to be crossed into a full time member (invited and not crossed)
Fraternity::Pledge.find(token).ready?
Check to see if a pledge has been crossed into a full member
Fraternity::Pledge.find(token).crossed?
Convert the pledge into a full member (accept the invitation).
Fraternity::Pledge.find(token).cross! token
CONTRIBUTING
- Clone the repository
git clone https://github.com/brilliantfantastic/fraternity
- Create a feature branch
git checkout -b my-awesome-feature
- Codez!
- Commit your changes (small commits please)
- Push your new branch
git push origin my-awesome-feature
- Create a pull request
hub pull-request -b brilliantfantastic:master -h brilliantfantastic:my-awesome-feature
RELEASING A NEW GEM
- Bump the VERSION in
lib/fraternity/version.rb
- Commit changes and push to GitHub
- run
bundle exec rake build
- run
bundle exec rake release