Class: Kwipper::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/kwipper/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Request

Returns a new instance of Request.

Yields:

  • (_self)

Yield Parameters:



6
7
8
9
# File 'lib/kwipper/request.rb', line 6

def initialize
  @post_data = {}
  yield self
end

Instance Attribute Details

#cookiesObject (readonly)

Returns the value of attribute cookies.



4
5
6
# File 'lib/kwipper/request.rb', line 4

def cookies
  @cookies
end

#headersObject

Returns the value of attribute headers.



3
4
5
# File 'lib/kwipper/request.rb', line 3

def headers
  @headers
end

#http_methodObject

Returns the value of attribute http_method.



3
4
5
# File 'lib/kwipper/request.rb', line 3

def http_method
  @http_method
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/kwipper/request.rb', line 4

def params
  @params
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/kwipper/request.rb', line 3

def path
  @path
end

#post_dataObject

Returns the value of attribute post_data.



3
4
5
# File 'lib/kwipper/request.rb', line 3

def post_data
  @post_data
end

#queryObject

Returns the value of attribute query.



3
4
5
# File 'lib/kwipper/request.rb', line 3

def query
  @query
end

Instance Method Details

#content_lengthObject



27
28
29
# File 'lib/kwipper/request.rb', line 27

def content_length
  headers.content_length
end

#infoObject



11
12
13
# File 'lib/kwipper/request.rb', line 11

def info
  "#{http_method} #{path}"
end

#post_data?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/kwipper/request.rb', line 31

def post_data?
  http_method == 'POST' && headers.has_content?
end

#route_keyObject



15
16
17
# File 'lib/kwipper/request.rb', line 15

def route_key
  [http_method.to_sym, path]
end