Sha256: 9cb79e7b29641e594e9839eb39f6948db5061af82f24b5f1edcbeaa52ea9f174

Contents?: true

Size: 340 Bytes

Versions: 4

Compression:

Stored size: 340 Bytes

Contents

# frozen_string_literal: true

class FolioClient
  # Wraps API operations to request new access token if expired
  class TokenWrapper
    def self.refresh(config, connection)
      yield
    rescue UnexpectedResponse::UnauthorizedError
      config.token = Authenticator.token(config.login_params, connection)
      yield
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
folio_client-0.4.0 lib/folio_client/token_wrapper.rb
folio_client-0.3.1 lib/folio_client/token_wrapper.rb
folio_client-0.3.0 lib/folio_client/token_wrapper.rb
folio_client-0.2.1 lib/folio_client/token_wrapper.rb