Class: OmniAuth::Strategies::Goodgame
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Goodgame
- Defined in:
- lib/omniauth/strategies/goodgame.rb
Constant Summary collapse
- DEFAULT_SCOPE =
''
Instance Method Summary collapse
- #access_token_options ⇒ Object
- #authorize_params ⇒ Object
- #build_access_token ⇒ Object
- #callback_url ⇒ Object
- #raw_info ⇒ Object
- #request_phase ⇒ Object
Instance Method Details
#access_token_options ⇒ Object
66 67 68 69 70 |
# File 'lib/omniauth/strategies/goodgame.rb', line 66 def ..each_with_object({}) do |(k, v), h| h[k.to_sym] = v end end |
#authorize_params ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/omniauth/strategies/goodgame.rb', line 78 def super.tap do |params| [:authorize_options].each do |k| params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s]) end params[:scope] = params[:scope] || DEFAULT_SCOPE end end |
#build_access_token ⇒ Object
60 61 62 63 64 |
# File 'lib/omniauth/strategies/goodgame.rb', line 60 def build_access_token super.tap do |token| token..merge!() end end |
#callback_url ⇒ Object
72 73 74 75 76 |
# File 'lib/omniauth/strategies/goodgame.rb', line 72 def callback_url return [:redirect_uri] unless [:redirect_uri].nil? full_host + script_name + callback_path end |
#raw_info ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/omniauth/strategies/goodgame.rb', line 52 def raw_info id = access_token.get("https://goodgame.ru/api/4/users/@me2?access_token=#{access_token.token}", headers: { 'Accept' => 'application/json' }).parsed.fetch('id') @raw_info = access_token.get("https://goodgame.ru/api/4/users/#{id}?access_token=#{access_token.token}", headers: { 'Accept' => 'application/json' }).parsed end |
#request_phase ⇒ Object
21 22 23 24 25 |
# File 'lib/omniauth/strategies/goodgame.rb', line 21 def request_phase redirect client.auth_code .({ redirect_uri: callback_url } .merge()).gsub(/%2[b,B]/, '+') end |