Class: AutoForme::Request
- Inherits:
-
Object
- Object
- AutoForme::Request
- Defined in:
- lib/autoforme/request.rb
Overview
Request wraps a specific web request for a given framework.
Direct Known Subclasses
Frameworks::Rails::Request, Frameworks::Roda::Request, Frameworks::Sinatra::Request
Instance Attribute Summary collapse
-
#action_type ⇒ Object
readonly
A string representing the action type for the request.
-
#controller ⇒ Object
readonly
The underlying web framework request instance for the request.
-
#env ⇒ Object
readonly
The HTTP request environment hash.
-
#id ⇒ Object
readonly
The id related to the request, which is usually the primary key of the related model instance.
-
#method ⇒ Object
readonly
The request method (GET or POST) for the request.
-
#model ⇒ Object
readonly
A string representing the model for the request.
-
#params ⇒ Object
readonly
The params for the current request.
-
#path ⇒ Object
readonly
A string representing the path that the root of the application is mounted at.
-
#session ⇒ Object
readonly
The session variables for the current request.
Instance Method Summary collapse
-
#post? ⇒ Boolean
Whether the current request used the POST HTTP method.
-
#query_string ⇒ Object
The query string for the current request.
-
#set_flash_notice(message) ⇒ Object
Set the flash at notice level when redirecting, so it shows up on the redirected page.
-
#set_flash_now_error(message) ⇒ Object
Set the current flash at error level, used when displaying pages when there is an error.
Instance Attribute Details
#action_type ⇒ Object (readonly)
A string representing the action type for the request
16 17 18 |
# File 'lib/autoforme/request.rb', line 16 def action_type @action_type end |
#controller ⇒ Object (readonly)
The underlying web framework request instance for the request
7 8 9 |
# File 'lib/autoforme/request.rb', line 7 def controller @controller end |
#env ⇒ Object (readonly)
The HTTP request environment hash
27 28 29 |
# File 'lib/autoforme/request.rb', line 27 def env @env end |
#id ⇒ Object (readonly)
The id related to the request, which is usually the primary key of the related model instance.
24 25 26 |
# File 'lib/autoforme/request.rb', line 24 def id @id end |
#method ⇒ Object (readonly)
The request method (GET or POST) for the request
10 11 12 |
# File 'lib/autoforme/request.rb', line 10 def method @method end |
#model ⇒ Object (readonly)
A string representing the model for the request
13 14 15 |
# File 'lib/autoforme/request.rb', line 13 def model @model end |
#params ⇒ Object (readonly)
The params for the current request
30 31 32 |
# File 'lib/autoforme/request.rb', line 30 def params @params end |
#path ⇒ Object (readonly)
A string representing the path that the root of the application is mounted at
20 21 22 |
# File 'lib/autoforme/request.rb', line 20 def path @path end |
#session ⇒ Object (readonly)
The session variables for the current request
33 34 35 |
# File 'lib/autoforme/request.rb', line 33 def session @session end |
Instance Method Details
#post? ⇒ Boolean
Whether the current request used the POST HTTP method.
36 37 38 |
# File 'lib/autoforme/request.rb', line 36 def post? method == 'POST' end |
#query_string ⇒ Object
The query string for the current request
41 42 43 |
# File 'lib/autoforme/request.rb', line 41 def query_string @env['QUERY_STRING'] end |
#set_flash_notice(message) ⇒ Object
Set the flash at notice level when redirecting, so it shows up on the redirected page.
47 48 49 |
# File 'lib/autoforme/request.rb', line 47 def set_flash_notice() @controller.flash[:notice] = end |
#set_flash_now_error(message) ⇒ Object
Set the current flash at error level, used when displaying pages when there is an error.
53 54 55 |
# File 'lib/autoforme/request.rb', line 53 def set_flash_now_error() @controller.flash.now[:error] = end |