Class: OmniAuth::Strategies::Starling

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

Direct Known Subclasses

StarlingSandbox

Constant Summary collapse

DEFAULT_SCOPE =
"customer:read".freeze

Instance Method Summary collapse

Instance Method Details

#api_urlObject



9
10
11
# File 'lib/omniauth/strategies/starling.rb', line 9

def api_url
  "https://api.starlingbank.com"
end

#authorize_paramsObject



44
45
46
47
48
49
50
51
# File 'lib/omniauth/strategies/starling.rb', line 44

def authorize_params
  super.tap do |params|
    options[: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

#callback_urlObject



35
36
37
38
# File 'lib/omniauth/strategies/starling.rb', line 35

def callback_url
  return options[:redirect_uri] unless options[:redirect_uri].nil?
  full_host + script_name + callback_path
end

#raw_infoObject



40
41
42
# File 'lib/omniauth/strategies/starling.rb', line 40

def raw_info
  @raw_info ||= access_token.get("#{api_url}/api/v2/account-holder").parsed
end