Class: OmniAuth::Strategies::Bitbucket
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Bitbucket
- Defined in:
- lib/omniauth/strategies/bitbucket.rb
Constant Summary collapse
- EMAIL =
"email".freeze
- ACCOUNT =
"account".freeze
Instance Method Summary collapse
- #authorize_params ⇒ Object
- #callback_url ⇒ Object
- #emails ⇒ Object
- #primary_email ⇒ Object
- #raw_info ⇒ Object
Instance Method Details
#authorize_params ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/omniauth/strategies/bitbucket.rb', line 15 def super.tap do |params| scope = params[:scope].to_s.split(/\s+/) scope << EMAIL unless scope.include?(EMAIL) scope << ACCOUNT unless scope.include?(ACCOUNT) params[:scope] = scope.join(" ") end end |
#callback_url ⇒ Object
24 25 26 |
# File 'lib/omniauth/strategies/bitbucket.rb', line 24 def callback_url full_host + script_name + callback_path end |
#emails ⇒ Object
55 56 57 |
# File 'lib/omniauth/strategies/bitbucket.rb', line 55 def emails @emails ||= deep_symbolize(access_token.get("/api/2.0/user/emails").parsed).fetch(:values) end |
#primary_email ⇒ Object
59 60 61 |
# File 'lib/omniauth/strategies/bitbucket.rb', line 59 def primary_email (emails.find {|info| info["is_primary"] } || {})["email"] end |
#raw_info ⇒ Object
51 52 53 |
# File 'lib/omniauth/strategies/bitbucket.rb', line 51 def raw_info @raw_info ||= deep_symbolize(access_token.get("/api/2.0/user").parsed) end |