Class: Putio::Middleware::OauthToken
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Putio::Middleware::OauthToken
- Defined in:
- lib/putio-ruby/middleware/oauth_token.rb
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/putio-ruby/middleware/oauth_token.rb', line 4 def call(env) raise Putio::ApplicationCredentialsRequired, "No OAuth token provided" unless Putio.configuration.oauth_token oauth_string = "oauth_token=#{Putio.configuration.oauth_token}" query = env[:url].query env[:url].query = query ? "#{query}&#{oauth_string}" : oauth_string @app.call(env) end |