From 37a4a28deec224f7cd9a5a124e22258e868913e4 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 26 Nov 2012 21:40:21 +0100 Subject: added the first set of documentation --- doc/Zero/Request.html | 1476 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1476 insertions(+) create mode 100644 doc/Zero/Request.html (limited to 'doc/Zero/Request.html') diff --git a/doc/Zero/Request.html b/doc/Zero/Request.html new file mode 100644 index 0000000..03e5591 --- /dev/null +++ b/doc/Zero/Request.html @@ -0,0 +1,1476 @@ + + + + + + Class: Zero::Request + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request.rb,
+ lib/zero/request/server.rb,
lib/zero/request/client.rb,
lib/zero/request/accept.rb,
lib/zero/request/parameter.rb,
lib/zero/request/accept_type.rb
+
+ +
+
+ +

Overview

+
+ +

This class wraps around a rack environment for easier access to all data.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Accept, AcceptType, Client, Parameter, Server + + +

+ +

Constant Summary

+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Request) initialize(env) + + + + + +

+
+ +

create a new request object

+ + +
+
+
+ + +
+ + + + +
+
+
+
+15
+16
+17
+18
+
+
# File 'lib/zero/request.rb', line 15
+
+def initialize(env)
+  @env = env
+  @env['zero.request'] = self
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + - (Hash) env (readonly) + + + + + +

+
+ +

get the environment

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +
    +

    the environment hash

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/zero/request.rb', line 22
+
+def env
+  @env
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) create(environment) + + + + + +

+ + + + +
+
+
+
+9
+10
+11
+12
+
+
# File 'lib/zero/request.rb', line 9
+
+def self.create(environment)
+  return environment['zero.request'] if environment.has_key?('zero.request')
+  new(environment)
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Accept) accept + + + + + +

+
+ +

get the media types

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Accept) + + + + — +
    +

    on Accept object managing all types and their order

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/zero/request.rb', line 57
+
+def accept
+  @accept ||= Request::Accept.new(@env)
+end
+
+
+
+ +
+

+ + - (Client) client + + + + + +

+
+ +

return all information about the client

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Client) + + + + — +
    +

    an information object about the client

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/zero/request.rb', line 32
+
+def client
+  @client ||= Request::Client.new(@env)
+end
+
+
+
+ +
+

+ + - (String) content_type + + + + + +

+
+ +

return the content type of the request TODO change into its own object?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    returns the content type of the request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/zero/request.rb', line 51
+
+def content_type
+  @env[CONST_CONTENT_TYPE] if @env.has_key?(CONST_CONTENT_TYPE)
+end
+
+
+
+ +
+

+ + - (Boolean) delete? + + + + + +

+
+ +

is the method 'DELETE'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a delete request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+77
+
+
# File 'lib/zero/request.rb', line 77
+
+def delete?; method == :delete end
+
+
+
+ +
+

+ + - (Boolean) get? + + + + + +

+
+ +

is the method 'GET'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a get request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+68
+
+
# File 'lib/zero/request.rb', line 68
+
+def get?;  method == :get  end
+
+
+
+ +
+

+ + - (Boolean) head? + + + + + +

+
+ +

is the method 'HEAD'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a head request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+80
+
+
# File 'lib/zero/request.rb', line 80
+
+def head?; method == :head end
+
+
+
+ +
+

+ + - (Symbol) method + + + + + +

+
+ +

get the method of the request

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +
    +

    the symbol representation of the method

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+63
+64
+65
+
+
# File 'lib/zero/request.rb', line 63
+
+def method
+  @method ||= @env[CONST_REQUEST_METHOD].downcase.to_sym
+end
+
+
+
+ +
+

+ + - (Parameter) params + + + + + +

+
+ +

get an object representing the parameters of the request

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Parameter) + + + + — +
    +

    object having all parameters

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/zero/request.rb', line 44
+
+def params
+  @params ||= Request::Parameter.new(@env)
+end
+
+
+
+ +
+

+ + - (Boolean) patch? + + + + + +

+
+ +

is the method 'PATCH'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a patch request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+83
+
+
# File 'lib/zero/request.rb', line 83
+
+def patch?; method == :patch end
+
+
+
+ +
+

+ + - (String) path + + + + + +

+
+ +

get the requested path

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    returns the requested path

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/zero/request.rb', line 26
+
+def path
+  @path ||= @env[CONST_PATH_INFO]
+end
+
+
+
+ +
+

+ + - (Boolean) post? + + + + + +

+
+ +

is the method 'POST'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a post request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+71
+
+
# File 'lib/zero/request.rb', line 71
+
+def post?; method == :post end
+
+
+
+ +
+

+ + - (Boolean) put? + + + + + +

+
+ +

is the method 'PUT'?

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if this is a put request

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+74
+
+
# File 'lib/zero/request.rb', line 74
+
+def put?;  method == :put  end
+
+
+
+ +
+

+ + - (Server) server + + + + + +

+
+ +

get the information on the server

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Server) + + + + — +
    +

    information on the running server

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/zero/request.rb', line 38
+
+def server
+  @server ||= Request::Server.new(@env)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file -- cgit v1.2.3-70-g09d2