Class: ContextIO::Request::ContextIOOAuth Private
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- ContextIO::Request::ContextIOOAuth
- Defined in:
- lib/context-io/request/oauth.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Faraday middleware for handling the OAuth header
Instance Method Summary collapse
-
#call(env) ⇒ Array
private
Add the OAuth header.
-
#initialize(app, options) ⇒ ContextIOOAuth
constructor
private
Initialize the OAuth middleware.
Constructor Details
#initialize(app, options) ⇒ ContextIOOAuth
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the OAuth middleware
38 39 40 |
# File 'lib/context-io/request/oauth.rb', line 38 def initialize(app, ) @app, @options = app, end |
Instance Method Details
#call(env) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add the OAuth header
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/context-io/request/oauth.rb', line 15 def call(env) params = env[:body] || {} signature_params = params params.each do |key, value| signature_params = {} if value.respond_to?(:content_type) end header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options) env[:request_headers]['Authorization'] = header.to_s @app.call(env) end |