Class: OmniAuth::Strategies::BoletoSimples

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

Constant Summary collapse

DEFAULT_SCOPE =
"profile"
ENVIRONMENTS =
{
  development: 'http://localhost:5000',
  sandbox: 'https://sandbox.boletosimples.com.br',
  production: 'https://boletosimples.com.br',
}

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



75
76
77
78
79
# File 'lib/omniauth/strategies/boletosimples.rb', line 75

def authorize_params
  super.tap do |params|
    params[:scope] ||= DEFAULT_SCOPE
  end
end

#raw_infoObject



71
72
73
# File 'lib/omniauth/strategies/boletosimples.rb', line 71

def raw_info
  @raw_info ||= load_identity
end

#setup_phaseObject



60
61
62
63
64
65
66
67
68
69
# File 'lib/omniauth/strategies/boletosimples.rb', line 60

def setup_phase
  environment = options.environment || :production
  options.client_options[:site] = ENVIRONMENTS[environment.to_sym]
  options.client_options[:authorize_url] = "#{ENVIRONMENTS[environment.to_sym]}/api/v1/oauth2/authorize"
  options.client_options[:connection_opts] = {
    headers: {
      'User-Agent' => options.user_agent,
    }
  } if options.user_agent
end