Class: FaradayMiddleware::PaytureAuth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FaradayMiddleware::PaytureAuth
- Defined in:
- lib/faraday/payture_auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, access_token = nil) ⇒ PaytureAuth
constructor
A new instance of PaytureAuth.
Constructor Details
#initialize(app, access_token = nil) ⇒ PaytureAuth
Returns a new instance of PaytureAuth.
20 21 22 23 |
# File 'lib/faraday/payture_auth.rb', line 20 def initialize(app, access_token=nil) @app = app @access_token = access_token end |
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/faraday/payture_auth.rb', line 5 def call(env) if env[:url].query.nil? query = {} else query = Faraday::Utils.parse_query(env[:url].query) end if @access_token env[:url].query = Faraday::Utils.build_query(query.merge('VWID' => @access_token)) end @app.call env end |