Class: MangoApi::MemoryStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/mangopay/api/auth_token_manager.rb

Overview

Stores client-specific OAuth tokens in-memory.

Instance Method Summary collapse

Constructor Details

#initializeMemoryStorage

Returns a new instance of MemoryStorage.



98
99
100
# File 'lib/mangopay/api/auth_token_manager.rb', line 98

def initialize
  @token = {}
end

Instance Method Details

#retrieve_for(client_id) ⇒ Object

Retrieves a client-specific OAuth token.

Parameters:

  • +client_id+

    ID of the client whose token to retrieve



105
106
107
# File 'lib/mangopay/api/auth_token_manager.rb', line 105

def retrieve_for(client_id)
  @token[client_id]
end

#store_for(client_id, token) ⇒ Object

Stores a client-specific OAuth token.

Parameters:

  • +client_id+

    ID of the client for which token is being stored

  • +token+

    OAuth token for this client



113
114
115
# File 'lib/mangopay/api/auth_token_manager.rb', line 113

def store_for(client_id, token)
  @token[client_id] = token
end