Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/bigbluebutton_rails/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#bigbluebutton_routes(*params) ⇒ Object

Helper to define routes for bigbluebutton_rails.

Avaliable options

bigbluebutton_routes :default
bigbluebutton_routes :room_matchers

Default routes

Passing the option :default, it will generate the default routes to access bigbluebutton servers and rooms. These routes are the resourceful routes generated by rails to a resource, plus the other available actions for servers and rooms.

bigbluebutton_routes :default

Examples of some routes generated:

bigbluebutton_server               GET    /bigbluebutton/servers/:id(.:format)
                                          { :action=>"show", :controller=>"bigbluebutton/servers" }
                                   POST   /bigbluebutton/servers/:id(.:format)
                                          { :action=>"update", :controller=>"bigbluebutton/servers" }
join_bigbluebutton_room            GET    /bigbluebutton/rooms/:id/join(.:format)
                                          { :action=>"join", :controller=>"bigbluebutton/rooms" }
running_bigbluebutton_room         GET    /bigbluebutton/rooms/:id/running(.:format)
                                          { :action=>"running", :controller=>"bigbluebutton/rooms" }

The routes point by default to the controllers Bigbluebutton::ServersController and Bigbluebutton::RoomsController and they are scoped (namespaced) with ‘bigbluebutton’. You can change the namespace with:

bigbluebutton_routes :default, :scope => "webconference"

You can also change the controllers with:

bigbluebutton_routes :default, :controllers { :servers => "custom_servers", :rooms => "custom_rooms" }

Room matchers

Generates matchers to access a room from a different url or inside another resource. Rooms can belong to users, communities or any other type of “entity” in an aplication. This helper creates routes to the all the actions available in Bigbluebutton::RoomsController.

bigbluebutton_routes :room_matchers

You can, for example, create routes associated with users:

resources :users do
  bigbluebutton_routes :room_matchers
end

Examples of some routes generated:

user_room               GET  /users/:user_id/room/:id(.:format)
                             { :controller=>"bigbluebutton/rooms", :action=>"show" }
user_join_room          GET  /users/:user_id/room/:id/join(.:format)
                             { :controller=>"bigbluebutton/rooms", :action=>"join" }
user_end_room           GET  /users/:user_id/room/:id/end(.:format)
                             { :controller=>"bigbluebutton/rooms", :action=>"end" }
user_invite_room        GET  /users/:user_id/room/:id/invite(.:format)
                             { :controller=>"bigbluebutton/rooms", :action=>"invite" }


65
66
67
68
# File 'lib/bigbluebutton_rails/rails/routes.rb', line 65

def bigbluebutton_routes(*params)
  options = params.extract_options!
  send("bigbluebutton_routes_#{params[0].to_s}", options)
end