class OmniAuth::Strategies::Square

Public Instance Methods

build_access_token() click to toggle source
# File lib/omniauth/strategies/square.rb, line 29
def build_access_token
  connect_client = client.dup
  connect_client.site = options.client_options.connect_site
  auth_params = {
    redirect_uri: callback_url,
    client_id: options.client_id,
    client_secret: options.client_secret,
    grant_type: 'authorization_code'
  }.merge(token_params.to_hash(symbolize_keys: true))
  connect_client.auth_code.get_token(
    request.params['code'],
    auth_params.merge(
      token_params.to_hash(symbolize_keys: true)
    ),
    deep_symbolize(options.auth_token_params)
  )
end

Private Instance Methods

prune!(hash) click to toggle source
# File lib/omniauth/strategies/square.rb, line 53
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
raw_info() click to toggle source
# File lib/omniauth/strategies/square.rb, line 49
def raw_info
  @raw_info ||= access_token.get('/v2/merchants').parsed
end