Class: Kwipper::Request
- Inherits:
-
Object
- Object
- Kwipper::Request
- Defined in:
- lib/kwipper/request.rb
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#post_data ⇒ Object
Returns the value of attribute post_data.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #content_length ⇒ Object
- #info ⇒ Object
-
#initialize {|_self| ... } ⇒ Request
constructor
A new instance of Request.
- #post_data? ⇒ Boolean
- #route_key ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Request
Returns a new instance of Request.
6 7 8 9 |
# File 'lib/kwipper/request.rb', line 6 def initialize @post_data = {} yield self end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
4 5 6 |
# File 'lib/kwipper/request.rb', line 4 def @cookies end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/kwipper/request.rb', line 3 def headers @headers end |
#http_method ⇒ Object
Returns the value of attribute http_method.
3 4 5 |
# File 'lib/kwipper/request.rb', line 3 def http_method @http_method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/kwipper/request.rb', line 4 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/kwipper/request.rb', line 3 def path @path end |
#post_data ⇒ Object
Returns the value of attribute post_data.
3 4 5 |
# File 'lib/kwipper/request.rb', line 3 def post_data @post_data end |
#query ⇒ Object
Returns the value of attribute query.
3 4 5 |
# File 'lib/kwipper/request.rb', line 3 def query @query end |
Instance Method Details
#content_length ⇒ Object
27 28 29 |
# File 'lib/kwipper/request.rb', line 27 def content_length headers.content_length end |
#info ⇒ Object
11 12 13 |
# File 'lib/kwipper/request.rb', line 11 def info "#{http_method} #{path}" end |
#post_data? ⇒ Boolean
31 32 33 |
# File 'lib/kwipper/request.rb', line 31 def post_data? http_method == 'POST' && headers.has_content? end |
#route_key ⇒ Object
15 16 17 |
# File 'lib/kwipper/request.rb', line 15 def route_key [http_method.to_sym, path] end |