<commit_before>require 'travis/api/serialize/formats'
require 'travis/github/oauth'
require 'travis/remote_vcs/user'
require 'travis/remote_vcs/response_error'

module Travis
  module Api
    module Serialize
      module V2
        module Http
          class User
            include Formats

            attr_reader :user, :options

            def initialize(user, options = {})
              @user = user
              @options = options
            end

            def data
              {
                'user' => user_data,
              }
              rescue Exception
                raise Travis::API::V3::LoginRequired
            end

            private

              def user_data
                data = {
                  'id'                 => user.id,
                  'name'               => user.name,
                  'login'              => user.login,
                  'email'              => user.email,
                  'gravatar_id'        => user.email ? Digest::MD5.hexdigest(user.email) : "",
                  'avatar_url'         => user.avatar_url,
                  'locale'             => user.locale,
                  'is_syncing'         => user.syncing?,
                  'synced_at'          => format_date(user.synced_at),
                  'correct_scopes'     => check_scopes,
                  'created_at'         => format_date(user.created_at),
                  'first_logged_in_at' => format_date(user.first_logged_in_at),
                  'channels'           => channels,
                  'allow_migration'    => allow_migration,<commit_msg>Add vcs_type to v2 serializer<commit_after>require 'travis/api/serialize/formats'
require 'travis/github/oauth'
require 'travis/remote_vcs/user'
require 'travis/remote_vcs/response_error'

module Travis
  module Api
    module Serialize
      module V2
        module Http
          class User
            include Formats

            attr_reader :user, :options

            def initialize(user, options = {})
              @user = user
              @options = options
            end

            def data
              {
                'user' => user_data,
              }
              rescue Exception
                raise Travis::API::V3::LoginRequired
            end

            private

              def user_data
                data = {
                  'id'                 => user.id,
                  'name'               => user.name,
                  'login'              => user.login,
                  'email'              => user.email,
                  'gravatar_id'        => user.email ? Digest::MD5.hexdigest(user.email) : "",
                  'avatar_url'         => user.avatar_url,
                  'locale'             => user.locale,
                  'is_syncing'         => user.syncing?,
                  'synced_at'          => format_date(user.synced_at),
                  'correct_scopes'     => check_scopes,
                  'created_at'         => format_date(user.created_at),
                  'first_logged_in_at' => format_date(user.first_logged_in_at),
                  'channels'           => channels,
                  'allow_migration'    => allow_migration,
                  'vcs_type'           => user.vcs_type
{'fraction_non_alphanumeric': 0.09054878048780488, 'fraction_numerical': 0.002134146341463415, 'mean_word_length': 1.1319038336582197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 34, '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': '6258075', 'n_tokens_mistral': 879, 'n_tokens_neox': 841, 'n_words': 155}