lib/chatrix/api/session.rb
# Gets a new access token to use for API calls when the current one
# expires.
#
# @note On success, the internal {Matrix#access_token access_token} and
#   `refresh_token` will be updated automatically for use in
#   subsequent API calls.
#
# @param token [String,nil] The `refresh_token` to provide for the server
#   when requesting a new token. If not set, the internal refresh and
#   access tokens will be used.
# @return [Hash] The response hash from the server will contain the new
#   access token and a refresh token to use the next time a new access
#   token is needed.
Gets a new access token to use for API calls when the current one
expires.
Gets a new access token to use for API calls when the current one expires .
def refresh(token = nil)
        refresh_token = token || @refresh_token || @access_token
        response = make_request(
          :post,
          '/tokenrefresh',
          content: { refresh_token: refresh_token }
        )
        @matrix.access_token = response['access_token']
        @refresh_token = response['refresh_token']
        response.parsed_response
      end
def refresh ( token = nil ) refresh_token = token || @refresh_token || @access_token response = make_request ( :post , '/tokenrefresh' , content : { refresh_token : refresh_token } ) @matrix . access_token = response [ 'access_token' ] @refresh_token = response [ 'refresh_token' ] response . parsed_response end
Gets a new access token to use for API calls when the current one
expires.
Gets a new access token to use for API calls when the current one expires .
The response hash from the server will contain the new access token and a refresh token to use the next time a new access token is needed.
The response hash from the server will contain the new access token and a refresh token to use the next time a new access token is needed .
Hash
token
The `refresh_token` to provide for the server when requesting a new token. If not set, the internal refresh and access tokens will be used.
The ` refresh_token ` to provide for the server when requesting a new token . If not set the internal refresh and access tokens will be used .
note
On success, the internal {Matrix#access_token access_token} and `refresh_token` will be updated automatically for use in subsequent API calls.
On success the internal { Matrix#access_token access_token } and ` refresh_token ` will be updated automatically for use in subsequent API calls .