Module: QPay::Endpoints::Auth

Included in:
Client
Defined in:
lib/qpay/endpoints/auth.rb

Instance Method Summary collapse

Instance Method Details

#get_token ⇒ QPay::TokenResponse

Authenticates with QPay using Basic Auth and returns a new token pair. Also stores the token for subsequent requests.

Returns:



10
11
12
13
14
# File 'lib/qpay/endpoints/auth.rb', line 10

def get_token
  token = get_token_request
  store_token(token)
  token
end

#refresh_token ⇒ QPay::TokenResponse

Uses the current refresh token to obtain a new access token.

Returns:



19
20
21
22
23
24
# File 'lib/qpay/endpoints/auth.rb', line 19

def refresh_token
  refresh_tok = @mutex.synchronize { @refresh_token }
  token = do_refresh_token_http(refresh_tok)
  store_token(token)
  token
end