Class: Blix::Rest::Context
- Inherits:
-
Struct
- Object
- Struct
- Blix::Rest::Context
- Defined in:
- lib/blix/rest/controller.rb
Overview
base class for controllers. within your block handling a particular route you have access to a number of methods
env : the request environment hash body : the request body as a string body_hash : the request body as a hash constructed from json query_params : a hash of parameters as passed in the url as parameters path_params : a hash of parameters constructed from variable parts of the path params : all the params combined user : the user making this request ( or nil if format : the format the response should be in :json or :html session : the rack session if middleware has been used
to accept requests other thatn json then set :accept=>[:json,:html] as options in the route
eg post '/myform' :accept=>[:html] # this will only accept html requests.
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#method ⇒ Object
Returns the value of attribute method.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path_params ⇒ Object
Returns the value of attribute path_params.
-
#req ⇒ Object
Returns the value of attribute req.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_options ⇒ Object
Returns the value of attribute response_options.
-
#server ⇒ Object
Returns the value of attribute server.
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def format @format end |
#method ⇒ Object
Returns the value of attribute method
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def method @method end |
#params ⇒ Object
Returns the value of attribute params
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def params @params end |
#path_params ⇒ Object
Returns the value of attribute path_params
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def path_params @path_params end |
#req ⇒ Object
Returns the value of attribute req
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def req @req end |
#response ⇒ Object
Returns the value of attribute response
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def response @response end |
#response_options ⇒ Object
Returns the value of attribute response_options
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def @response_options end |
#server ⇒ Object
Returns the value of attribute server
25 26 27 |
# File 'lib/blix/rest/controller.rb', line 25 def server @server end |