<commit_before>class Pipedrive::API
  PIPEDRIVE_ALL_NOT_DELETED_DEALS = 'all_not_deleted'

  def self.get_persons_owned_by_user(user_id)
    params = { user_id: user_id }

    self.get(PIPEDRIVE_PEOPLE_URL, params)
  end

  def self.get_deals_for_person(person_id)
    url = [PIPEDRIVE_PEOPLE_URL, person_id, "deals"].join('/')

    params = { status: PIPEDRIVE_ALL_NOT_DELETED_DEALS }

    self.get(url, params)
  end

  def self.put_deal(deal_id, params)
    url = PIPEDRIVE_DEALS_URL + "/#{deal_id}?api_token=#{PIPEDRIVE_TOKEN}"

    self.put(url, params)
  end

  def self.put_person(person_id, params)
    url = PIPEDRIVE_PEOPLE_URL + "/#{person_id}?api_token=#{PIPEDRIVE_TOKEN}"

    self.put(url, params)
  end

  private

  def self.get(url, params)
    params.merge!({
      start: 0,
      limit: 500,
      api_token: PIPEDRIVE_TOKEN
    })

    response = RestClient.get(url, params: params)
    JSON.parse(response.body)['data']
  end

  def self.put(url, params)
    RestClient.put(url, params.to_json, { content_type: :json })
  end
end<commit_msg>Mutualize some code in Pipedrive::API#put<commit_after>class Pipedrive::API
  PIPEDRIVE_ALL_NOT_DELETED_DEALS = 'all_not_deleted'

  def self.get_persons_owned_by_user(user_id)
    params = { user_id: user_id }

    self.get(PIPEDRIVE_PEOPLE_URL, params)
  end

  def self.get_deals_for_person(person_id)
    url = [PIPEDRIVE_PEOPLE_URL, person_id, "deals"].join('/')

    params = { status: PIPEDRIVE_ALL_NOT_DELETED_DEALS }

    self.get(url, params)
  end

  def self.put_deal(deal_id, params)
    url = PIPEDRIVE_DEALS_URL + "/#{deal_id}"

    self.put(url, params)
  end

  def self.put_person(person_id, params)
    url = PIPEDRIVE_PEOPLE_URL + "/#{person_id}"

    self.put(url, params)
  end

  private

  def self.get(url, params)
    params.merge!({
      start: 0,
      limit: 500,
      api_token: <PASSWORD>_TOKEN
    })

    response = RestClient.get(url, params: params)
    JSON.parse(response.body)['data']
  end

  def self.put(url, params)
    url = "#{url}?api_token=#{PIPEDRIVE_TOKEN}"

    RestClient.put(url, params.to_json, { content_type: :json })
  end
end
{'fraction_non_alphanumeric': 0.12208760484622554, 'fraction_numerical': 0.003727865796831314, 'mean_word_length': 3.7817371937639197, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5290320', 'n_tokens_mistral': 890, 'n_tokens_neox': 853, 'n_words': 141}