Sha256: 21b2f5623e19a78a22a032f041e6493bc9fb20ce0135c82ab0db04c120da8ed6

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

Contents

require 'omniauth-oauth'
require 'multi_json'

module OmniAuth
  module Strategies
    class Myspace < OmniAuth::Strategies::OAuth
      option :name, 'myspace'

      option :client_options, {
        :site               => 'http://api.myspace.com',
        :authorize_path     => '/authorize',
        :access_token_path  => '/access_token',
        :request_token_path => '/request_token',
        :http_method        => 'get',
        :scheme             => :query_string,
      }

      uid { raw_info['id'] }

      info do
        {
          :id           => raw_info['id'],
          :nickname     => raw_info['nickname'],
          :name         => raw_info['displayName'],
          :image        => raw_info['thumbnailUrl'],
        }
      end

      extra do
        {
          'raw_info' => raw_info
        }
      end

      def raw_info
        @raw_info ||= MultiJson.decode(access_token.get('/v2/people/@me/@self?format=json').body)['entry']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-myspace-0.0.2 lib/omniauth/strategies/myspace.rb