diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-13 14:07:38 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-13 14:29:55 +0100 |
commit | c5e34da01d6ef4717f934754c9c2d1beadd8c55e (patch) | |
tree | 0a2aabf7b1156c8f36fe273f795ea3bf2d16a38e /lib/omniauth | |
parent | 32da7602686f2b8161175d82b121deb9e01b2db5 (diff) | |
download | gitlab-ce-c5e34da01d6ef4717f934754c9c2d1beadd8c55e.tar.gz |
Remove explicit `require` calls, and use `require_dependency` when needed29389-fix-already-initialized-constants
See
http://guides.rubyonrails.org/autoloading_and_reloading_constants.html
for more info.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/omniauth')
-rw-r--r-- | lib/omniauth/strategies/bitbucket.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/omniauth/strategies/bitbucket.rb b/lib/omniauth/strategies/bitbucket.rb deleted file mode 100644 index 5a7d67c2390..00000000000 --- a/lib/omniauth/strategies/bitbucket.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'omniauth-oauth2' - -module OmniAuth - module Strategies - class Bitbucket < OmniAuth::Strategies::OAuth2 - option :name, 'bitbucket' - - option :client_options, { - site: 'https://bitbucket.org', - authorize_url: 'https://bitbucket.org/site/oauth2/authorize', - token_url: 'https://bitbucket.org/site/oauth2/access_token' - } - - uid do - raw_info['username'] - end - - info do - { - name: raw_info['display_name'], - avatar: raw_info['links']['avatar']['href'], - email: primary_email - } - end - - def raw_info - @raw_info ||= access_token.get('api/2.0/user').parsed - end - - def primary_email - primary = emails.find { |i| i['is_primary'] && i['is_confirmed'] } - primary && primary['email'] || nil - end - - def emails - email_response = access_token.get('api/2.0/user/emails').parsed - @emails ||= email_response && email_response['values'] || nil - end - end - end -end |