<commit_before>require 'omniauth/strategies/oauth'

module OmniAuth
  module Strategies
    class Ning < OmniAuth::Strategies::OAuth
      include OmniAuth::Strategy

        DEFAULT_ENDPOINT = 'https://external.ningapis.com/xn/rest/YRGUniverse/1.0'
        option :name, "ning"
        option :fields, :email

        # This is where you pass the options you would pass when
        # initializing your consumer from the OAuth gem.
        option :client_options, {
          site:           DEFAULT_ENDPOINT,
          authorize_url:  "/Token",
          token_url:      "/Token"
        }

      # These are called after authentication has succeeded. If
      # possible, you should try to set the UID without making
      # additional calls (if the user id is returned with the token
      # or as a URI parameter). This may not be possible with all
      # providers.
      uid{ request.params['entry']['author'] }

      info do
        {
          author: raw_info['entry']['author'],
          oauth_token: raw_info['entry']['oauthToken'],
          oauth_token_secret: raw_info['entry']['oauthTokenSecret']
        }
      end<commit_msg>Updates request and callback phase.<commit_after>require 'omniauth/strategies/oauth'

module OmniAuth
  module Strategies
    class Ning < OmniAuth::Strategies::OAuth
      include OmniAuth::Strategy

        DEFAULT_ENDPOINT = 'https://external.ningapis.com/xn/rest/YRGUniverse/1.0'
        option :name, "ning"
        option :oauth_token

        # This is where you pass the options you would pass when
        # initializing your consumer from the OAuth gem.
        option :client_options, {
          site:           DEFAULT_ENDPOINT,
          token_url:      "/Token"
        }

      def request_phase
        if options.oauth_token.present?
          super
        else
          redirect '/ning_sessions/new'
        end
      end

      # These are called after authentication has succeeded. If
      # possible, you should try to set the UID without making
      # additional calls (if the user id is returned with the token
      # or as a URI parameter). This may not be possible with all
      # providers.
      uid{ request.params['entry']['author'] }

      info do
        {
          author: params['entry']['author'],
          oauth_consumer_key: params['entry']['oauth_consumer_key'],
          oauth_token: params['entry']['oauth_token'],
          oauth_token_secret: params['entry']['oauth_token_secret']
        }
      end
{'fraction_non_alphanumeric': 0.08843537414965986, 'fraction_numerical': 0.001600640256102441, 'mean_word_length': 2.2981530343007917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4416955', 'n_tokens_mistral': 688, 'n_tokens_neox': 674, 'n_words': 208}