Class: Tap::Ubiquity::Ubiquity
- Inherits:
-
Controller
- Object
- Controller
- Tap::Ubiquity::Ubiquity
- Includes:
- Utils
- Defined in:
- lib/tap/ubiquity/ubiquity.rb
Overview
:startdoc::controller an index of available ubiquity feeds :startdoc::ubiquity :startdoc:::-
The Ubiquity controller provides an index of feeds available in the current environment. Ubiquity expects to run with a Tap::Server that has a router (otherwise the uris for the feeds may be off).
% tap server
Ubiquity controllers are identifies by the ‘::ubiquity’ resource identifier. The subject of the identifier specifies which action provides the feed. The default action is ‘commands’; multiple commands can be provided from the same feed.
Note that ubiquity controllers must also be identified as controllers using the ‘::controller’ resource id.
See Tap::Ubiquity::Utils for more information.
:startdoc:::+
Constant Summary collapse
- UBIQUITY_WEBSITE =
"http://labs.mozilla.com/projects/ubiquity/"
Instance Method Summary collapse
-
#alert ⇒ Object
An example of a js_injection action.
-
#commands ⇒ Object
Serves the echo and alert actions as examples of standard and javascript injection commands.
-
#echo ⇒ Object
An example of a command action.
-
#index ⇒ Object
Renders an index of the available feeds.
Methods included from Utils
#command, #command_link, #js_injection, #serve
Instance Method Details
#alert ⇒ Object
An example of a js_injection action.
56 57 58 59 |
# File 'lib/tap/ubiquity/ubiquity.rb', line 56 def alert response['Content-Type'] = 'text/plain' "alert('#{request['input']}')" end |
#commands ⇒ Object
Serves the echo and alert actions as examples of standard and javascript injection commands.
41 42 43 |
# File 'lib/tap/ubiquity/ubiquity.rb', line 41 def commands serve command(:echo) + js_injection(:alert) end |
#echo ⇒ Object
An example of a command action.
46 47 48 49 50 51 52 53 |
# File 'lib/tap/ubiquity/ubiquity.rb', line 46 def echo input = request['input'] if request.get? "Got: #{input}" else render 'echo.erb', :locals => {:input => input} end end |
#index ⇒ Object
Renders an index of the available feeds.
34 35 36 37 |
# File 'lib/tap/ubiquity/ubiquity.rb', line 34 def index link = {:uri => request['uri'], :name => request['name']} render 'index.erb', :locals => {:feeds => feeds, :link => link} end |