Skip to content

Ruby on Rails plugin for adding Venue Driver Reservations, Guest Lists, and Contacts signups via the REST API.

License

Notifications You must be signed in to change notification settings

VenueDriver/promoter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Venue Driver Promoter

This plugin provides easy client access for Rails 3 web sites to the Venue Driver REST API. You must
have access to a Venue Driver account to use this plugin in a web site. For Rails 2 support, get the
rails2 branch.

Features

  • Remote read access to Venue Driver Event records through Active Resource.
  • The ability to create new Reservation and Guest list records through Active Resource.
  • A convenience custom REST collection action that returns a drop-down HTML selector with an event list, for signup forms.
  • The ability to create new mailing list signups by posting to a Contacts resource.
  • Rails 3 compatible

Installation

The Promoter plugin functions as a Rails Engine plugin and it is compatible with Rails 3. It is
not set up to be used as a Rails Engine when installed as a gem, only when used as a plugin.

As a Rails 3 plugin:

rails plugin install https://github.com/angelmg/promoter.git

As a Git submodule:

git submodule add git@github.com:angelmg/promoter.git

Be sure to include jQuery in your page layout. This plugin originally used Prototype, but now it uses jQuery.

Configuration

The plugin needs to know your Venue Driver account information. You can configure that information by adding an initializer to your app in config/initializers/promoter.rb like this:

VENUE_DRIVER = {
  :username => 'somewebsite',
  :password => 'yourpassword',
  :account_id => 908134,
  :venue_id => 124319,
  :staff_id => 250728
}

You can also specify the :local_server boolean value (:local_server => true) to instruct the Promoter plugin to look for Venue Driver at localhost:3000 instead of venuedriver.com.

Your New Classes

The Promoter plugin provides some important model classes for communicating with Venue Driver. The following are mirrors of model classes in Venue Driver:

  • Contact
  • Event
  • Flyer
  • Guest
  • Reservation

In addition, the plugin provides some utility classes. The EventSelect model wraps a 15-minute Rails cache around the select_event Venue Driver REST API method. To refresh the cache, use the Rake task provided by the Promoter plugin:

rake promoter:event_select:refresh

Your New Routes

The plugin provides new routes for your Rails 3 web app:

  • /reservations
  • /guestlists
  • /contacts

Those routes provide functional UI for handling signups. You can override those templates by copying the Promoter plugin’s views into /app/views/promoter in your Rails 3 app. In most cases you’ll probably want to override the templates, because the included templates were factored out of a real venue’s web app, and they make assumptions about images that you probably don’t have. Notably the indicator.gif in the forms.

The EventSelect model

You can use the EventSelect model to display a select tag in your view templates that contains the upcoming Event records in Venue Driver for the configured Venue. Use it like this:

  <%= EventSelect.tag.html_safe %>

The three included controllers, ContactsController, GuestlistsController, and ReservationsController, all derive from a common PromoterController, which sets @events equal to EventSelect.tag, so the forms in the view templates use:

  <%= @events.html_safe %>

The AreaSelect model

AreaSelect is a utility model similar to EventSelect, for displaying an HTML select tag containing the seating areas available for your venue. Use it like this:

  <%= AreaSelect.tag.html_safe %>

Action Names

This plugin uses RESTful routing. Therefore, the form for creating a new reservation or guest or contact signup is “new”. A name like “form” might sound more intuitive, but REST says that it should be “new”. Any thank-you message would be the result of a reservation getting posted, which is a “create”. So the thank-you confirmation message goes in “create”.

Email Overrides

If you need to send an email or perform some other action instead of doing a Venue Driver signup, then you can override the controllers and you can add the :with_names => true option to EventSelect.tag so that the values submitted in the form will be the names of events instead of numeric database ID’s.

  <%= EventSelect.tag(:with_names => true).tag.html_safe %>

About

Ruby on Rails plugin for adding Venue Driver Reservations, Guest Lists, and Contacts signups via the REST API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages