25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/typhoeus_oauth/module_extension.rb', line 25
def remote_proxy_object_with_oauth(url, method, options)
unless options.has_key? :oauth_consumer
remote_proxy_object_without_oauth(url, method, options)
else
easy = Typhoeus.get_easy_object
easy.url = url
easy.method = method
easy. = options[:headers] if options.has_key?(:headers)
easy.["User-Agent"] = (options[:user_agent] || Typhoeus::USER_AGENT)
easy.params = options[:params] if options[:params]
easy.request_body = options[:body] if options[:body]
easy.timeout = options[:timeout] if options[:timeout]
if options.has_key?(:oauth_token_key) && options.has_key?(:oauth_token_secret)
options[:oauth_token] ||= OAuth::AccessToken.new(options[:oauth_consumer], options[:oauth_token_key], options[:oauth_token_secret])
end
easy.oauth!(options[:oauth_consumer], options[:oauth_token])
easy.
proxy = Typhoeus::RemoteProxyObject.new(clear_memoized_proxy_objects, easy, options)
set_memoized_proxy_object(method, url, options, proxy)
end
end
|