Sha256: 7580db20c8de05567c83330178f6c4401c116386bb8f10906cd169e865618d49

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Appnet < OmniAuth::Strategies::OAuth2

      option :name, 'appnet'

      option :client_options, {
        :site => 'https://alpha-api.app.net',
        :authorize_url => 'https://alpha.app.net/oauth/authenticate',
        :token_url => 'https://alpha.app.net/oauth/access_token'
      }

      uid { raw_info['id'] }

      info do
        {
          :nickname => raw_info['username'],
          :name => raw_info['name'],
          :image => raw_info['avatar_image']['url'],
          :description => raw_info['description']['text'],
          :type => raw_info['type'],
          :counts => raw_info['counts']
        }
      end

      extra do
        { :raw_info => raw_info }
      end

      def raw_info
        @raw_info ||= access_token.get('stream/0/users/me').parsed
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-appnet-0.0.5 lib/omniauth/strategies/appnet.rb
omniauth-appnet-0.0.4 lib/omniauth/strategies/appnet.rb
omniauth-appnet-0.0.3 lib/omniauth/strategies/appnet.rb