class OmniAuth::Strategies::Bnet

Public Instance Methods

authorize_params() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/bnet.rb, line 31
def authorize_params
  super.tap do |params|
    %w[scope client_options].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
      end
    end
  end
end
client() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/bnet.rb, line 12
def client
  # Setup urls based on region option
  if !options.client_options.has_key(:authorize_url)
    options.client_options[:authorize_url] = "https://#{getHost(options.region)}/oauth/authorize"
  end
  if !options.client_options.has_key(:token_url)
    options.client_options[:token_url] = "https://#{getHost(options.region)}/oauth/token"
  end
  if !options.client_options.has_key(:site)
    options.client_options[:site] = "https://#{getHost(options.region)}/"
  end

  super
end
raw_info() click to toggle source
# File lib/omniauth/strategies/bnet.rb, line 47
def raw_info
  return @raw_info if @raw_info

  access_token.options[:mode] = :query

  @raw_info = access_token.get('oauth/userinfo').parsed
end
request_phase() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/bnet.rb, line 27
def request_phase
  super
end

Private Instance Methods

callback_url() click to toggle source
# File lib/omniauth/strategies/bnet.rb, line 57
def callback_url
  full_host + script_name + callback_path
end
getHost(region) click to toggle source
# File lib/omniauth/strategies/bnet.rb, line 61
def getHost(region)
  case region
  when "cn"
    "www.battlenet.com.cn"
  else
    "#{region}.battle.net"
  end
end