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



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

def method
  request.method.to_s.upcase
end

#parametersObject



50
51
52
53
54
55
56
57
58
# File 'lib/opensocial/auth/action_controller_request.rb', line 50

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/opensocial/auth/action_controller_request.rb', line 63

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



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

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