Class: SonarSession::MockDigestRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/sonar/session.rb

Overview

stolen from rack-test

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ MockDigestRequest

Returns a new instance of MockDigestRequest.



128
129
130
# File 'lib/sonar/session.rb', line 128

def initialize(params)
  @params = params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object



132
133
134
135
136
137
138
# File 'lib/sonar/session.rb', line 132

def method_missing(sym)
  if @params.has_key? k = sym.to_s
    return @params[k]
  end

  super
end

Instance Method Details

#methodObject



140
141
142
# File 'lib/sonar/session.rb', line 140

def method
  @params['method']
end

#response(password) ⇒ Object



144
145
146
# File 'lib/sonar/session.rb', line 144

def response(password)
  Rack::Auth::Digest::MD5.new(nil).send :digest, self, password
end