Sha256: 4dc6332ee3e55ff264023d534116baf2e92817c505474aef313a605808b5f9ee

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

require 'omniauth/strategies/oauth2'

class OmniAuth::Strategies::Seesaw < OmniAuth::Strategies::OAuth2
  option :name, 'seesaw'
  option :client_options, { :site => 'https://api.seesaw.co' }

  uid do
    raw_info['id']
  end

  info do
    {
      :username => raw_info['username'],
      :display_name => raw_info['display_name'],
      :short_display_name => raw_info['short_display_name'],
      :biography => raw_info['biography'],
      :created_at => raw_info['created_at'],
      :avatar_url => raw_info['avatar_url']
    }
  end

  extra do
    {
      :raw_info => raw_info
    }
  end

  def raw_info
    @raw_info ||= access_token.get('/v1/me').parsed
  end

  def authorize_params
    super.tap do |params|
      # Read the params if passed directly to omniauth_authorize_path
      %w(invitation_slug).each do |k|
        params[k.to_sym] = request.params[k] unless [nil, ''].include?(request.params[k])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-seesaw-0.1.3 lib/omniauth/strategies/seesaw.rb