Sha256: 61fbf13ff1e9fa6e0aadd3335d71b9f1522e2ebcd25b3539022e4fd16655a457

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 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',
      }

      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.1 lib/omniauth/strategies/myspace.rb