Class: BlueFactory::RequestContext
- Inherits:
-
Object
- Object
- BlueFactory::RequestContext
- Defined in:
- lib/blue_factory/request_context.rb
Overview
An object which provides some metadata about the getFeedSkeleton request being processed.
The context is passed to the FeedHandler#get_posts method of the provided feed handler object,
if the method is made to accept two parameters.
Instance Attribute Summary collapse
-
#request ⇒ Sinatra::Request
readonly
Returns the underlying request object.
Instance Method Summary collapse
-
#env ⇒ Hash
The request environment hash.
-
#has_auth? ⇒ Boolean
Indicates if an authorization header was provided at all or not.
-
#initialize(request) ⇒ RequestContext
constructor
A new instance of RequestContext.
-
#user ⇒ UserInfo
Parsed user information derived from the authorization header.
Constructor Details
#initialize(request) ⇒ RequestContext
Returns a new instance of RequestContext.
24 25 26 |
# File 'lib/blue_factory/request_context.rb', line 24 def initialize(request) @request = request end |
Instance Attribute Details
#request ⇒ Sinatra::Request (readonly)
Returns the underlying request object.
18 19 20 |
# File 'lib/blue_factory/request_context.rb', line 18 def request @request end |
Instance Method Details
#env ⇒ Hash
The request environment hash.
32 33 34 |
# File 'lib/blue_factory/request_context.rb', line 32 def env @request.env end |
#has_auth? ⇒ Boolean
Indicates if an authorization header was provided at all or not.
48 49 50 |
# File 'lib/blue_factory/request_context.rb', line 48 def has_auth? env['HTTP_AUTHORIZATION'] != nil end |
#user ⇒ UserInfo
Parsed user information derived from the authorization header.
40 41 42 |
# File 'lib/blue_factory/request_context.rb', line 40 def user UserInfo.new(env['HTTP_AUTHORIZATION']) end |