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/Accept.html | 612 ++++++++++++++++++++++++++++++++++ doc/Zero/Request/AcceptType.html | 403 +++++++++++++++++++++++ doc/Zero/Request/Client.html | 579 +++++++++++++++++++++++++++++++++ doc/Zero/Request/Parameter.html | 489 ++++++++++++++++++++++++++++ doc/Zero/Request/Server.html | 687 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 2770 insertions(+) create mode 100644 doc/Zero/Request/Accept.html create mode 100644 doc/Zero/Request/AcceptType.html create mode 100644 doc/Zero/Request/Client.html create mode 100644 doc/Zero/Request/Parameter.html create mode 100644 doc/Zero/Request/Server.html (limited to 'doc/Zero/Request') diff --git a/doc/Zero/Request/Accept.html b/doc/Zero/Request/Accept.html new file mode 100644 index 0000000..8a45ae0 --- /dev/null +++ b/doc/Zero/Request/Accept.html @@ -0,0 +1,612 @@ + + + + + + Class: Zero::Request::Accept + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request::Accept + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request/accept.rb
+ +
+
+ +

Overview

+
+ +

encapsulates the accept header to easier work with this is partly copied +from sinatra

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
MEDIA_TYPE_SEPERATOR = + +
+
','
+
+ +
MEDIA_PARAM_SEPERATOR = + +
+
';'
+
+ +
MEDIA_QUALITY_REGEX = + +
+
/q=[01]\./
+
+ +
KEY_HTTP_ACCEPT = + +
+
'HTTP_ACCEPT'
+
+ +
KEY_HTTP_ACCEPT_LANGUAGE = + +
+
'HTTP_ACCEPT_LANGUAGE'
+
+ +
KEY_HTTP_ACCEPT_ENCODING = + +
+
'HTTP_ACCEPT_ENCODING'
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Accept) initialize(environment) + + + + + +

+
+ +

create a new accept object

+ + +
+
+
+ + +
+ + + + +
+
+
+
+25
+26
+27
+28
+29
+
+
# File 'lib/zero/request/accept.rb', line 25
+
+def initialize(environment)
+  @types = AcceptType.new(environment[KEY_HTTP_ACCEPT])
+  @language = AcceptType.new(environment[KEY_HTTP_ACCEPT_LANGUAGE])
+  @encoding = AcceptType.new(environment[KEY_HTTP_ACCEPT_ENCODING])
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + - (Object) encoding (readonly) + + + + + +

+
+ +

Returns the value of attribute encoding

+ + +
+
+
+ + +
+ + + + +
+
+
+
+33
+34
+35
+
+
# File 'lib/zero/request/accept.rb', line 33
+
+def encoding
+  @encoding
+end
+
+
+
+ + + +
+

+ + - (Object) language (readonly) + + + + + +

+
+ +

Returns the value of attribute language

+ + +
+
+
+ + +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/zero/request/accept.rb', line 32
+
+def language
+  @language
+end
+
+
+
+ + + +
+

+ + - (Object) types (readonly) + + + + + +

+
+ +

Returns the value of attribute types

+ + +
+
+
+ + +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/zero/request/accept.rb', line 31
+
+def types
+  @types
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) map + + + + + +

+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/zero/request/accept.rb', line 20
+
+def self.map
+  @@map ||= {}
+end
+
+
+
+ +
+

+ + + (Object) map=(map) + + + + + +

+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/zero/request/accept.rb', line 16
+
+def self.map=(map)
+  @@map = map
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Zero/Request/AcceptType.html b/doc/Zero/Request/AcceptType.html new file mode 100644 index 0000000..603d3d3 --- /dev/null +++ b/doc/Zero/Request/AcceptType.html @@ -0,0 +1,403 @@ + + + + + + Class: Zero::Request::AcceptType + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request::AcceptType + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request/accept_type.rb
+ +
+
+ +

Overview

+
+ +

This class provides an interface to access information of accept schemas.

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
MEDIA_TYPE_SEPERATOR = + +
+
','
+
+ +
MEDIA_PARAM_SEPERATOR = + +
+
';'
+
+ +
MEDIA_QUALITY_REGEX = + +
+
/q=[01]\./
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (AcceptType) initialize(string) + + + + + +

+
+ +

create a new instance of AcceptType

+ + +
+
+
+ + +
+ + + + +
+
+
+
+10
+11
+12
+13
+14
+15
+16
+
+
# File 'lib/zero/request/accept_type.rb', line 10
+
+def initialize(string)
+  if string.nil?
+    @elements = []
+  else
+    @elements = parse_elements(string)
+  end
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) each + + + + + +

+
+ +

iterate over all media types

+ + +
+
+
+ + +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/zero/request/accept_type.rb', line 25
+
+def each
+  @elements.each {|element| yield element}
+end
+
+
+
+ +
+

+ + - (Object) preferred + + + + + +

+
+ +

return the preferred type

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + + + + + +
    +

    String the preferred media type

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+20
+21
+22
+
+
# File 'lib/zero/request/accept_type.rb', line 20
+
+def preferred
+  @elements.first
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Zero/Request/Client.html b/doc/Zero/Request/Client.html new file mode 100644 index 0000000..f2e733d --- /dev/null +++ b/doc/Zero/Request/Client.html @@ -0,0 +1,579 @@ + + + + + + Class: Zero::Request::Client + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request::Client + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request/client.rb
+ +
+
+ +

Overview

+
+ +

This class represents all information about the client of a request.

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
KEY_REMOTE_ADDR = +
+
+ +

the key for the ip of the client

+ + +
+
+
+ + +
+
+
'REMOTE_ADDR'
+
+ +
KEY_REMOTE_HOST = +
+
+ +

the key for the hostname

+ + +
+
+
+ + +
+
+
'REMOTE_HOST'
+
+ +
KEY_USER_AGENT = +
+
+ +

the key for the user agent

+ + +
+
+
+ + +
+
+
'HTTP_USER_AGENT'
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Client) initialize(environment) + + + + + +

+
+ +

creates a new client with the data of the request environment

+ + +
+
+
+

Parameters:

+
    + +
  • + + environment + + + + + + + — +
    +

    a hash representation of the request

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+14
+15
+16
+17
+18
+
+
# File 'lib/zero/request/client.rb', line 14
+
+def initialize(environment)
+  @address    = environment[KEY_REMOTE_ADDR]
+  @hostname   = environment[KEY_REMOTE_HOST]
+  @user_agent = environment[KEY_USER_AGENT]
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + - (String) address (readonly) + + + + + +

+
+ +

the ip address of the client

+ + +
+
+
+ +

Returns:

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

    the address of the client

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

+ + - (String) hostname (readonly) + + + + + +

+
+ +

the hostname of the client

+ + +
+
+
+ +

Returns:

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

    the hostname of the client

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/zero/request/client.rb', line 25
+
+def hostname
+  @hostname
+end
+
+
+
+ + + +
+

+ + - (String) user_agent (readonly) + + + + + +

+
+ +

the user agent of the client

+ + +
+
+
+ +

Returns:

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

    the user agent of the client

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/zero/request/client.rb', line 28
+
+def user_agent
+  @user_agent
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/doc/Zero/Request/Parameter.html b/doc/Zero/Request/Parameter.html new file mode 100644 index 0000000..e8c170c --- /dev/null +++ b/doc/Zero/Request/Parameter.html @@ -0,0 +1,489 @@ + + + + + + Class: Zero::Request::Parameter + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request::Parameter + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request/parameter.rb
+ +
+
+ +

Overview

+
+ +

represents all parameter set in a session

+ +

This class holds all parameters available in the rack environment, split on +query and payload parameters.

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
ENV_KEY_QUERY = +
+
+ +

they key for the query string

+ + +
+
+
+ + +
+
+
'QUERY_STRING'
+
+ +
ENV_KEY_PAYLOAD = +
+
+ +

the key for the payload

+ + +
+
+
+ + +
+
+
'rack.input'
+
+ +
ENV_KEY_CONTENT_TYPE = +
+
+ +

the key for the content type

+ + +
+
+
+ + +
+
+
'CONTENT_TYPE'
+
+ +
PAYLOAD_CONTENT_TYPES = +
+
+ +

all content types which used for using the body as a parameter input

+ + +
+
+
+ + +
+
+
[
+  'application/x-www-form-urlencoded',
+  'multipart/form-data'
+].to_set
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Parameter) initialize(environment) + + + + + +

+
+ +

creates a new parameter instance

+ +

This should never be called directly, as it will be generated for you. This +instance gives you the options to get query parameters (mostly called GET +parameters) and payload parameters (or POST parameters).

+ + +
+
+
+

Parameters:

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

    the rack environment

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+37
+38
+39
+40
+
+
# File 'lib/zero/request/parameter.rb', line 37
+
+def initialize(environment)
+  @query   = extract_query_params(environment)
+  @payload = extract_payload_params(environment)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + - (Object) payload (readonly) + + + + Also known as: + post + + + + +

+
+ +

get the payload or form data parameters

+ + +
+
+
+ + +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/zero/request/parameter.rb', line 28
+
+def payload
+  @payload
+end
+
+
+
+ + + +
+

+ + - (Object) query (readonly) + + + + Also known as: + get + + + + +

+
+ +

get the query parameters

+ + +
+
+
+ + +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/zero/request/parameter.rb', line 24
+
+def query
+  @query
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/doc/Zero/Request/Server.html b/doc/Zero/Request/Server.html new file mode 100644 index 0000000..2a187d8 --- /dev/null +++ b/doc/Zero/Request/Server.html @@ -0,0 +1,687 @@ + + + + + + Class: Zero::Request::Server + + — Documentation by YARD 0.8.3 + + + + + + + + + + + + + + + + + + + + + +

Class: Zero::Request::Server + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/zero/request/server.rb
+ +
+
+ +

Overview

+
+ +

This class represents all server related information of a request.

+ + +
+
+
+ + +
+

Constant Summary

+ +
+ +
KEY_SERVER_NAME = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+ +

the key for the server name

+ + +
+
+
+ + +
+
+
'SERVER_NAME'
+
+ +
KEY_SERVER_PORT = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+ +

the key for the server port

+ + +
+
+
+ + +
+
+
'SERVER_PORT'
+
+ +
KEY_SERVER_PROTOCOL = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+ +

the key for the server protocol

+ + +
+
+
+ + +
+
+
'SERVER_PROTOCOL'
+
+ +
KEY_SERVER_SOFTWARE = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+ +

the key for the server software

+ + +
+
+
+ + +
+
+
'SERVER_SOFTWARE'
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Server) initialize(environment) + + + + + +

+
+ +

This creates a new server instance extracting all server related

+ +
information from the environment.
+ + +
+
+
+ + +
+ + + + +
+
+
+
+20
+21
+22
+23
+24
+25
+
+
# File 'lib/zero/request/server.rb', line 20
+
+def initialize(environment)
+  @hostname = environment[KEY_SERVER_NAME]
+  @port     = environment[KEY_SERVER_PORT].to_i
+  @protocol = environment[KEY_SERVER_PROTOCOL]
+  @software = environment[KEY_SERVER_SOFTWARE]
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + - (String) hostname (readonly) + + + + + +

+
+ +

get the hostname of the server

+ + +
+
+
+ +

Returns:

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

    the hostname

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/zero/request/server.rb', line 32
+
+def hostname
+  @hostname
+end
+
+
+
+ + + +
+

+ + - (Numeric) port (readonly) + + + + + +

+
+ +

get the port

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Numeric) + + + + — +
    +

    the port

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/zero/request/server.rb', line 29
+
+def port
+  @port
+end
+
+
+
+ + + +
+

+ + - (String) protocol (readonly) + + + + + +

+
+ +

get the protocol of the server (normally it should be HTTP/1.1)

+ + +
+
+
+ +

Returns:

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

    the protocol

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/zero/request/server.rb', line 35
+
+def protocol
+  @protocol
+end
+
+
+
+ + + +
+

+ + - (String) software (readonly) + + + + + +

+
+ +

get the server software

+ + +
+
+
+ +

Returns:

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

    the server software name

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/zero/request/server.rb', line 38
+
+def software
+  @software
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file -- cgit v1.2.3-70-g09d2