Module: KazeClient::Utils::AuthentifiedRequest

Overview

Included by the request where an authentication token is required.

See Also:

Author:

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tokenString (readonly)

Returns The authentication token.

Returns:

  • (String)

    The authentication token

Since:

  • 0.1.0



14
15
16
# File 'lib/kaze_client/request/requests/utils/authentified_request.rb', line 14

def token
  @token
end

Instance Method Details

#with_token(token) ⇒ KazeClient::Utils::AuthentifiedRequest

Store the given authentication token and use it to set the Authorization header of the request.

Parameters:

  • token (String)

    The authentication token

Returns:

Since:

  • 0.1.0



20
21
22
23
24
25
# File 'lib/kaze_client/request/requests/utils/authentified_request.rb', line 20

def with_token(token)
  @token                    = token
  @headers['Authorization'] = token

  self
end