class OmniAuth::Strategies::BikeIndex

Constants

DEFAULT_SCOPE

Public Instance Methods

callback_url() click to toggle source

github.com/omniauth/omniauth-oauth2/issues/81

# File lib/omniauth/strategies/bike_index.rb, line 53
def callback_url
  full_host + script_name + callback_path
end
param_or_option(key) click to toggle source
# File lib/omniauth/strategies/bike_index.rb, line 34
def param_or_option(key)
  # omniauth.params are the parameters passed in to the URL
  # (e.g. company in /users/auth/bike_index?company=Metro)
  # So for partner, company and unauthenticated_redirect it tries those params, then goes from settings
   session["omniauth.params"] && session["omniauth.params"][key] ||
    options[key]
end
raw_info() click to toggle source
# File lib/omniauth/strategies/bike_index.rb, line 30
def raw_info
  @raw_info ||= access_token.get("/api/v3/me").parsed || {}
end
request_phase() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/bike_index.rb, line 42
def request_phase
  options[:authorize_params] = {
    scope: (options["scope"] || DEFAULT_SCOPE),
    partner: param_or_option("partner"),
    company: param_or_option("company"),
    unauthenticated_redirect: param_or_option("unauthenticated_redirect")
  }
  super
end

Private Instance Methods

prune!(hash) click to toggle source
# File lib/omniauth/strategies/bike_index.rb, line 59
def prune!(hash)
  hash.delete_if do |_, value|
    prune!(value) if value.is_a?(Hash)
    value.nil? || (value.respond_to?(:empty?) && value.empty?)
  end
end