Sha256: c5408ffea7b7eca61990dacc03d60136097132e9b985a78c5b0819821cde8682

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

# Reservation

A gem for managing reservations. Provides the notion of "Event", which is basically an interval in time, and a
"Reservation", which is a many-to-many association model between Event and your objects.

There is no privileged event "owner", all associations are considered equivalent.

This gem uses ActiveRecord to store events and reservations

## Installation

Add this line to your application's Gemfile:

    gem 'reservation'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install reservation

## Usage

Objects associated with an event are called "subjects"; each event has many subjects, via an association
model called Reservation::Reservation. The simplest way to create a bunch of events is to use Event#create_weekly.
This will create a set of events, with the given subjects, within the given constraints, repeating weekly.

    subjects = [ { "role" => "owner", "subject" => matt, "status" => "confirmed" },
                 { "role" => "helpr", "subject" => bill, "status" => "tentative" },
                 { "role" => "place", "subject" => here, "status" => "tentative" }
               ]

    pattern = [ { "day" => "wed", "start" => "0930", "finish" => "1030"},
                { "day" => "wed", "start" => "18",   "finish" => "20"  },
                { "day" => "tue", "start" => "7",    "finish" => "830" } ]

    Reservation::Event.create_weekly "the_title", "2013-09-03", "2013-10-13", subjects, pattern

You can use Reservation::Event#build_weekly instead in order to instantiate the object graph without
persisting it.


## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


## license

MIT License

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reservation-0.0.3 README.md
reservation-0.0.2 README.md