Class: Rack::Auth::Digest::Request

Inherits:
AbstractRequest show all
Defined in:
lib/rack/auth/digest/request.rb

Instance Method Summary collapse

Methods inherited from AbstractRequest

#initialize, #parts, #provided?, #request, #scheme, #valid?

Constructor Details

This class inherits a constructor from Rack::Auth::AbstractRequest

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
39
# File 'lib/rack/auth/digest/request.rb', line 35

def method_missing(sym, *args)
  return super unless params.has_key?(key = sym.to_s)
  return params[key] if args.size == 0
  raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
end

Instance Method Details

#correct_uri?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rack/auth/digest/request.rb', line 19

def correct_uri?
  request.fullpath == uri
end

#digest?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rack/auth/digest/request.rb', line 15

def digest?
  "digest" == scheme
end

#methodObject



11
12
13
# File 'lib/rack/auth/digest/request.rb', line 11

def method
  @env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] || @env[REQUEST_METHOD]
end

#nonceObject



23
24
25
# File 'lib/rack/auth/digest/request.rb', line 23

def nonce
  @nonce ||= Nonce.parse(params['nonce'])
end

#paramsObject



27
28
29
# File 'lib/rack/auth/digest/request.rb', line 27

def params
  @params ||= Params.parse(parts.last)
end

#respond_to?(sym) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rack/auth/digest/request.rb', line 31

def respond_to?(sym, *)
  super or params.has_key? sym.to_s
end