Project

userq

0.0
No commit activity in last 3 years
No release in over 3 years
UserQ allows you to very quickly integrate awesome user-based queues into your Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
> 4.0.0
 Project Readme

UserQ: Simple User Queues for Rails

UserQ allows you to very quickly integrate awesome user-based queues into your Rails application. Many large ticketing websites such as Ticketmaster use queues as a means of user experience.

Build Status Dependency Status Gen Version

Screenshot

Example code

queue = UserQ::Queue.new(capacity: 50)

## Can we enter the queue?
if queue.enter_into_queue?
	entry = queue.enter
	# They have a place in the queue. Sell them a ticket!
else
	# No place in queue. Run this block again after n seconds.
end

# Default expiry: 180 seconds
puts entry.expires # => 180
sleep(5)
puts entry.expires # => 175

How does it work?

Tell it how much you capacity you have (i.e. how many available tickets are left) and then UserQ does its beautiful magic. Some of the questions you can ask UserQ:

  • How many "people" are in the queue?
  • When does the current users spot in the queue expire?
  • When do you think another spot in the queue will open? (i.e. average wait time)
  • Can I extend/shorten the current users spot in the queue?

Install

Install the gem:
$ gem install userq

Install the database model (automatically migrates):
$ rails generate userq:install

You're all setup!

UserQ Documentation

See the full documentation on the Wiki to see what you can do with UserQ.

Roadmap

  • Lots of more awesome looking tests
  • Develop the UserQ Wiki
  • Assign queue places in a chronological order (first into queue = first entry) instead of randomly

Release History

  • 25/12/13: Fixed bug in using custom data (and tests added for it)
  • 23/12/13: The initial version

LICENCE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.