<commit_before>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 { access_token.params['user_id'] }
      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']
        p "RAWINFO"
        p @raw_info
        @raw_info
      end
    end
  end
end<commit_msg>First pass at omniauth myspace gem<commit_after>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
{'fraction_non_alphanumeric': 0.13159167876149008, 'fraction_numerical': 0.0009675858732462506, 'mean_word_length': 1.7795698924731183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6120139', 'n_tokens_mistral': 656, 'n_tokens_neox': 636, 'n_words': 115}