Class: Request::OAuth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Request::OAuth
- Defined in:
- lib/faraday/request/oauth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options) ⇒ OAuth
constructor
A new instance of OAuth.
Constructor Details
#initialize(app, options) ⇒ OAuth
Returns a new instance of OAuth.
22 23 24 |
# File 'lib/faraday/request/oauth.rb', line 22 def initialize(app, ) @app, @options = app, end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/faraday/request/oauth.rb', line 7
def call(env)
params = env[:body] || {}
break
signature_params = params.reject{ |k,v| v.respond_to?(:content_type) || (env[:method] == :put) }
#header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
# Runscope Support
realURL = env[:url].sub(/-desk-com-(\w)+.runscope.net/, ".desk.com")
header = SimpleOAuth::Header.new(env[:method], realURL, signature_params, @options)
env[:request_headers]['theURL'] = realURL
env[:request_headers]['Authorization'] = header.to_s
@app.call(env)
end
|