Conditions | 3 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | require 'base64' |
||
13 | def call(env) |
||
14 | if @oauth2_token.expired? |
||
15 | @oauth2_token = @oauth2_token.refresh!({ headers: { 'Authorization' => 'Basic ' + get_api_key() } }) |
||
16 | end |
||
17 | |||
18 | unless @oauth2_token.token.to_s.empty? |
||
19 | env[:request_headers][AUTH_HEADER] = %(Bearer #{@oauth2_token.token}) |
||
20 | end |
||
21 | |||
22 | @app.call env |
||
23 | end |
||
24 | |||
39 |