<commit_before>require 'net/http'

class NanoTwitter
  API_VER = "v1"
  BASE_URI = "https://reptilesplash.herokuapp.com/api/#{API_VER}"
  TEST_BASE_URI = "http://localhost:4567/api/#{API_VER}"
  
  def get_request(uri_str, params=nil)
    # uri_str: unparsed string of request url
    uri = URI.parse(uri_str)
    if !params.nil?
      uri.query = URI.encode_www_form(params)
    end
    res = Net::HTTP.get_response(uri)
    res.body if res.is_a?(Net::HTTPSuccess)
  end

  def post_request(uri_str, params=nil)
    uri = URI.parse(uri_str)
    res = Net:HTTP.post_form(uri, params)
    puts res.body
  end

  def get_tweet(id)
    get_request("#{BASE_URI}/tweets/t/#{id}")
  end

end

n = NanoTwitter.new
puts n.get_tweet(194)
<commit_msg>clean up code<commit_after>require 'net/http'

class NanoTwitter
  API_VER = "v1"
  BASE_URI = "https://reptilesplash.herokuapp.com/api/#{API_VER}"
  TEST_BASE_URI = "http://localhost:4567/api/#{API_VER}"
  
  def get_request(uri_str, params=nil)
    # uri_str: unparsed string of request url
    uri = URI.parse(uri_str)
    if !params.nil?
      uri.query = URI.encode_www_form(params)
    end
    res = Net::HTTP.get_response(uri)
    res.body if res.is_a?(Net::HTTPSuccess)
  end

  def post_request(uri_str, params=nil)
    uri = URI.parse(uri_str)
    res = Net:HTTP.post_form(uri, params)
    puts res.body
  end

  def get_tweet(id)
    get_request("#{BASE_URI}/tweets/t/#{id}")
  end
end

{'fraction_non_alphanumeric': 0.1356050069541029, 'fraction_numerical': 0.009040333796940195, 'mean_word_length': 3.582802547770701, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3479440', 'n_tokens_mistral': 584, 'n_tokens_neox': 575, 'n_words': 102}