<commit_before>require 'json'
require 'httparty'
require 'octokit'

module GithubPm
  class Client
    ACCESS_TOKEN = "<KEY>"
    GITHUB_API_URL = "https://api.github.com"
    REPO_ROOT = "/repos/YOURREPOSITORY/"
    REPO = ENV['REPO']

    # gpm = GithubPm.new({username: 'xxxx', password: '<PASSWORD>'})
    # gpm.set_repo("rails/rails")
    # gpm.summarize_pull_request(xxx)
    # gpm.report

    def initialize(options=nil)
      @client = Octokit::Client.new(options) if options
    end

    def set_repository(repository)
      @repository = repository
    end

    def summarize_pull_request(number, options = {})
      pull = @client.pull_request(@repository, number, options)
      pull
    end

    class << self

      def fetch_pull_request(id, params = {})<commit_msg>success to connect to github<commit_after>require 'json'
require 'httparty'
require 'octokit'

module GithubPm
  class Client
    ACCESS_TOKEN = "<KEY>"
    GITHUB_API_URL = "https://api.github.com"
    REPO_ROOT = "/repos/YOURREPOSITORY/"
    REPO = ENV['REPO']

    # gpm = GithubPm.new({username: 'xxxx', password: '<PASSWORD>'})
    # gpm.set_repo("rails/rails")
    # gpm.summarize_pull_request(xxx)
    # gpm.report

    def initialize(options={})
      @client = Octokit::Client.new(options)
    end

    def set_repository(repository)
      @repository = repository
    end

    def summarize_pull_request(number, options = {})
      pr = @client.pull_request(@repository, number, options)
      p commits_url = pr["_links"]["commits"]["href"]
    end

    class << self
      def fetch_pull_request(id, params = {})
{'fraction_non_alphanumeric': 0.13146417445482866, 'fraction_numerical': 0.0, 'mean_word_length': 3.3760217983651226, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '1842230', 'n_tokens_mistral': 557, 'n_tokens_neox': 539, 'n_words': 108}