Module: BitBucket::Authorization

Included in:
API
Defined in:
lib/bitbucket_rest_api/authorization.rb

Instance Method Summary collapse

Instance Method Details

#authenticated?Boolean

Check whether authentication credentials are present

Returns:

  • (Boolean)


5
6
7
# File 'lib/bitbucket_rest_api/authorization.rb', line 5

def authenticated?
  basic_authed? || oauth_token?
end

#authenticationObject

Select authentication parameters



15
16
17
18
19
20
21
22
23
# File 'lib/bitbucket_rest_api/authorization.rb', line 15

def authentication
  if basic_auth?
    { basic_auth: basic_auth }
  elsif login? && password?
    { login: , password: password }
  else
    {}
  end
end

#basic_authed?Boolean

Check whether basic authentication credentials are present

Returns:

  • (Boolean)


10
11
12
# File 'lib/bitbucket_rest_api/authorization.rb', line 10

def basic_authed?
  basic_auth? || (login? && password?)
end