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'
}.freeze

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



79
80
81
82
83
# File 'lib/omniauth/strategies/boletosimples.rb', line 79

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

#callback_urlObject



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

def callback_url
  options[:redirect_uri] || (full_host + script_name + callback_path)
end

#raw_infoObject



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

def raw_info
  @raw_info ||= load_identity
end

#setup_phaseObject



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

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"

  return unless options.user_agent

  options.client_options[:connection_opts] = {
    headers: {
      'User-Agent' => options.user_agent
    }
  }
end