<commit_before>require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Fliva < OmniAuth::Strategies::OAuth2
      option :name, :fliva

      option :client_options, {
        :site => "https://api.fliva.com",
        :authorize_url => "/oauth/authorize"
      }

      uid { raw_info["id"] }

      info do
        {
          :account => raw_info["attributes"]["account"]["id"],
          :account_name => raw_info["attributes"]["account"]["title"],
          :user_name => raw_info["attributes"]["name"],
          :user_email => raw_info["attributes"]["email"]
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/me.json').parsed["data"]
      end

      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end<commit_msg>Fliva api no longer uses json-api format<commit_after>require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Fliva < OmniAuth::Strategies::OAuth2
      option :name, :fliva

      option :client_options, {
        :site => "https://api.fliva.com",
        :authorize_url => "/oauth/authorize"
      }

      uid { raw_info["id"] }

      info do
        {
          :account => raw_info["account"]["id"],
          :account_name => raw_info["account"]["title"],
          :user_name => raw_info["name"],
          :user_email => raw_info["email"]
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/me.json').parsed["data"]
      end

      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.13782252989301447, 'fraction_numerical': 0.0025173064820641915, 'mean_word_length': 2.2987551867219915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '341932', 'n_tokens_mistral': 500, 'n_tokens_neox': 505, 'n_words': 95}