Class: JSONAPI::Request
- Inherits:
-
Object
- Object
- JSONAPI::Request
- Defined in:
- lib/easy/jsonapi/request.rb,
lib/easy/jsonapi/request/query_param_collection.rb,
lib/easy/jsonapi/request/query_param_collection/page_param.rb,
lib/easy/jsonapi/request/query_param_collection/sort_param.rb,
lib/easy/jsonapi/request/query_param_collection/query_param.rb,
lib/easy/jsonapi/request/query_param_collection/fields_param.rb,
lib/easy/jsonapi/request/query_param_collection/filter_param.rb,
lib/easy/jsonapi/request/query_param_collection/include_param.rb,
lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb,
lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb
Overview
Contains all objects relating to a HTTP request
Defined Under Namespace
Classes: QueryParamCollection
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#http_method ⇒ Object
readonly
Returns the value of attribute http_method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
Instance Method Summary collapse
-
#initialize(env, query_param_collection, header_collection, document) ⇒ Request
constructor
A new instance of Request.
-
#to_s ⇒ Object
Simple representation of a request object.
Constructor Details
#initialize(env, query_param_collection, header_collection, document) ⇒ Request
Returns a new instance of Request.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/easy/jsonapi/request.rb', line 12 def initialize(env, query_param_collection, header_collection, document) # from env hash @path = env['REQUEST_PATH'] @http_method = env['REQUEST_METHOD'] @host = env['SERVER_NAME'] @port = env['SERVER_PORT'].to_i @query_string = env['QUERY_STRING'] # parsed objects @params = query_param_collection @headers = header_collection @body = document end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def headers @headers end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def host @host end |
#http_method ⇒ Object (readonly)
Returns the value of attribute http_method.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def http_method @http_method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def port @port end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
6 7 8 |
# File 'lib/easy/jsonapi/request.rb', line 6 def query_string @query_string end |
Instance Method Details
#to_s ⇒ Object
Simple representation of a request object.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/easy/jsonapi/request.rb', line 27 def to_s "Quick Access Methods:\n\n" \ "\tpath: #{@path}\n" \ "\thttp: #{@http}\n" \ "\thost: #{@host}\n" \ "\tport: #{@port}\n" \ "\tquery_string: #{@query_string}\n\n" \ "Accessing main sections of request:\n\n" \ "\tparams: #{@params}\n" \ "\theaders: #{@headers}\n" \ "\tbody: #{@body}" \ end |