Class: OmniAuth::Strategies::Mixer
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Mixer
- Defined in:
- lib/omniauth/strategies/mixer.rb
Constant Summary collapse
- BLANK_PARAMS =
[nil, ''].freeze
- DEFAULT_SCOPE =
'user:details:self'.freeze
- RAW_INFO_URL =
'/api/v1/users/current'.freeze
- SOCIAL_KEYS =
%w(facebook discord player twitter youtube).freeze
Instance Method Summary collapse
- #access_token_options ⇒ Object
- #authorize_params ⇒ Object
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #raw_info ⇒ Object
- #social_info ⇒ Object
- #urls_info ⇒ Object
Instance Method Details
#access_token_options ⇒ Object
44 45 46 47 48 49 |
# File 'lib/omniauth/strategies/mixer.rb', line 44 def ..each_with_object({}) do |(key, val), hsh| hsh[key.to_sym] = val hsh end end |
#authorize_params ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/omniauth/strategies/mixer.rb', line 51 def super.tap do |params| [:authorize_options].each do |key| val = request.params[key.to_s] params[key] = val unless BLANK_PARAMS.include? val end params[:scope] ||= DEFAULT_SCOPE end end |
#build_access_token ⇒ Object
61 62 63 64 65 |
# File 'lib/omniauth/strategies/mixer.rb', line 61 def build_access_token super.tap do |token| token..merge! end end |
#callback_url ⇒ Object
67 68 69 70 |
# File 'lib/omniauth/strategies/mixer.rb', line 67 def callback_url return [:redirect_url] if .key? :redirect_url full_host + script_name + callback_path end |
#raw_info ⇒ Object
72 73 74 |
# File 'lib/omniauth/strategies/mixer.rb', line 72 def raw_info @raw_info ||= access_token.get(RAW_INFO_URL).parsed end |
#social_info ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/omniauth/strategies/mixer.rb', line 76 def = raw_info['social'] SOCIAL_KEYS.each_with_object({}) do |key, hsh| hsh[key.to_sym] = [key] if .key? key hsh end end |
#urls_info ⇒ Object
84 85 86 87 88 |
# File 'lib/omniauth/strategies/mixer.rb', line 84 def urls_info { Mixer: "http://mixer.com/#{raw_info['channel']['token']}" } end |