lib/gitlab/request.rb
# Sets a PRIVATE-TOKEN or Authorization header for requests.
#
# @param [Hash] options A customizable set of options.
# @option options [Boolean] :unauthenticated true if the API call does not require user authentication.
# @raise [Error::MissingCredentials] if private_token and auth_token are not set.
Sets a PRIVATE-TOKEN or Authorization header for requests.
Sets a PRIVATE - TOKEN or Authorization header for requests .
def authorization_header(options)
      return if options[:unauthenticated]
      raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token
      options[:headers] = if @private_token.size < 21
                            { 'PRIVATE-TOKEN' => @private_token }
                          else
                            { 'Authorization' => "Bearer #{@private_token}" }
                          end
    end
def authorization_header ( options ) return if options [ :unauthenticated ] raise Error :: MissingCredentials , 'Please provide a private_token or auth_token for user' unless @private_token options [ :headers ] = if @private_token . size < 21 { 'PRIVATE-TOKEN' => @private_token } else { 'Authorization' => "Bearer #{@private_token}" } end end
Sets a PRIVATE-TOKEN or Authorization header for requests.
Sets a PRIVATE - TOKEN or Authorization header for requests .
[Error::MissingCredentials] if private_token and auth_token are not set.
[ Error :: MissingCredentials ] if private_token and auth_token are not set .
options
:unauthenticated true if the API call does not require user authentication.
: unauthenticated true if the API call does not require user authentication .
options A customizable set of options.
options A customizable set of options .