class Spaceship::TokenRefreshMiddleware
Public Class Methods
new(app, token)
click to toggle source
Calls superclass method
# File spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb, line 8 def initialize(app, token) @token = token super(app) end
Public Instance Methods
call(env)
click to toggle source
# File spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb, line 13 def call(env) if @token.expired? puts("App Store Connect API token expired at #{@token.expiration}... refreshing") if Spaceship::Globals.verbose? @token.refresh! end env.request_headers["Authorization"] = "Bearer #{@token.text}" @app.call(env) end