<commit_before>require "gitlab"
require "magnum/integration/ext/gitlab"

module Magnum::Integration
  class Gitlab < Base
    def initialize(private_token, endpoint=nil)
      @private_token = private_token
      @endpoint ||= "https://gitlab.com/api/v3"
    end

    def repositories
      client.projects.map { |r| init_repository(r) }
    end

    def repository(id)
      init_repository(client.project(id))
    end

    def hooks(repo)
      client.project_hooks(repo)
    end

    def create_hook(repo, url)
      client.add_project_hook(repo, url)
    end

    def delete_hook(repo, id)
      client.delete_project_hook(repo, id)
    end

    def deploy_keys(repo)
      client.deploy_keys(repo)
    end

    def deploy_key(repo, id)
      client.deploy_key(repo, id)<commit_msg>Raise argument error on gitlab initialization<commit_after>require "gitlab"
require "magnum/integration/ext/gitlab"

module Magnum::Integration
  class Gitlab < Base
    def initialize(private_token, endpoint=nil)
      @private_token = private_token
      @endpoint ||= "https://gitlab.com/api/v3"

      if @private_token.nil?
        raise ArgumentError, "Private token required"
      end

      if @endpoint.nil?
        raise ArgumentError, "Gitlab url required"
      end
    end

    def repositories
      client.projects.map { |r| init_repository(r) }
    end

    def repository(id)
      init_repository(client.project(id))
    end

    def hooks(repo)
      client.project_hooks(repo)
    end

    def create_hook(repo, url)
      client.add_project_hook(repo, url)
    end

    def delete_hook(repo, id)
      client.delete_project_hook(repo, id)
    end

    def deploy_keys(repo)
      client.deploy_keys(repo)
    end

    def deploy_key(repo, id)
      client.deploy_key(repo, id)
{'fraction_non_alphanumeric': 0.0930493273542601, 'fraction_numerical': 0.0011210762331838565, 'mean_word_length': 2.8973799126637556, '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': '1664018', 'n_tokens_mistral': 590, 'n_tokens_neox': 563, 'n_words': 124}