Class: Makanai::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/makanai/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



12
13
14
15
16
17
18
19
20
# File 'lib/makanai/request.rb', line 12

def initialize(env)
  super
  @env = env
  @url = build_url
  @origin_body = body&.read
  @query = parsed_url.query
  @params = build_params
  @method = build_method
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



9
10
11
# File 'lib/makanai/request.rb', line 9

def env
  @env
end

#methodObject (readonly)

Returns the value of attribute method.



9
10
11
# File 'lib/makanai/request.rb', line 9

def method
  @method
end

#origin_bodyObject (readonly)

Returns the value of attribute origin_body.



9
10
11
# File 'lib/makanai/request.rb', line 9

def origin_body
  @origin_body
end

#paramsObject

Returns the value of attribute params.



10
11
12
# File 'lib/makanai/request.rb', line 10

def params
  @params
end

#queryObject (readonly)

Returns the value of attribute query.



9
10
11
# File 'lib/makanai/request.rb', line 9

def query
  @query
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/makanai/request.rb', line 9

def url
  @url
end

Instance Method Details

#root_urlObject



22
23
24
# File 'lib/makanai/request.rb', line 22

def root_url
  @root_url ||= "#{parsed_url.scheme}://#{parsed_url.host}:#{parsed_url.port}"
end