Class: OAuth::RequestProxy::ActionControllerRequest

Inherits:
Base
  • Object
show all
Defined in:
lib/opensocial/auth/action_controller_request.rb

Instance Method Summary collapse

Instance Method Details

#methodObject



34
35
36
# File 'lib/opensocial/auth/action_controller_request.rb', line 34

def method
  request.method.to_s.upcase
end

#parametersObject



44
45
46
47
48
49
50
51
52
# File 'lib/opensocial/auth/action_controller_request.rb', line 44

def parameters
  if options[:clobber_request]
    options[:parameters] || {}
  else
    params = request_params.merge(query_params).merge(header_params)
    params.stringify_keys! if params.respond_to?(:stringify_keys!)
    params.merge(options[:parameters] || {})
  end
end

#parameters_for_signatureObject

Override from OAuth::RequestProxy::Base to avoid roundtrip conversion to Hash or Array and thus preserve the original parameter names



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/opensocial/auth/action_controller_request.rb', line 57

def parameters_for_signature
  params = []
  params << options[:parameters].to_query if options[:parameters]
 
  unless options[:clobber_request]
    params << header_params.to_query
    params << CGI.unescape(request.query_string) unless request.query_string.blank?
    if request.content_type == Mime::Type.lookup("application/x-www-form-urlencoded")
      params << CGI.unescape(request.raw_post)
    end
  end

  params.
    join('&').split('&').
    reject { |kv| kv =~ /^oauth_signature=.*/}.
    reject(&:blank?).
    map { |p| p.split('=') }
end

#uriObject



38
39
40
41
42
# File 'lib/opensocial/auth/action_controller_request.rb', line 38

def uri
  uri = URI.parse(request.protocol + request.host + request.port_string + request.path)
  uri.query = nil
  uri.to_s
end