Class: OmniAuth::Strategies::BikeIndex

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/bike_index.rb

Constant Summary collapse

DEFAULT_SCOPE =
"public"

Instance Method Summary collapse

Instance Method Details

#callback_urlObject



53
54
55
# File 'lib/omniauth/strategies/bike_index.rb', line 53

def callback_url
  full_host + script_name + callback_path
end

#param_or_option(key) ⇒ Object



34
35
36
37
38
39
40
# 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_infoObject



30
31
32
# File 'lib/omniauth/strategies/bike_index.rb', line 30

def raw_info
  @raw_info ||= access_token.get("/api/v3/me").parsed || {}
end

#request_phaseObject



42
43
44
45
46
47
48
49
50
# 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