<commit_before>require 'rest-client'
require 'pry'

module Ephemeral
  class Client
    BASE = 'http://api.ehpemeral.io/'

    def build(image, repo, command)

      response = RestClient.post('api.ehpemeral.io/v1/builds',
        {
          image:   image,
          repo:    repo,
          build_type: command
        }.to_json,
        content_type: :json,
        accept: :json
      )

      parsed_response = JSON.parse(response)
    end

    private

    def gen_uri(resource)
      uri = URI.parse(BASE)
      uri.path = "/v1/#{resource}"
      uri.to_s
    end
  end
end<commit_msg>Add post private method<commit_after>require 'rest-client'
require 'uri'
require 'json'

module Ephemeral
  class Client
    BASE = 'http://api.ehpemeral.io/'

    def build(image, repo, command)

      response = RestClient.post('api.ehpemeral.io/v1/builds',
        {
          image:   image,
          repo:    repo,
          build_type: command
        }.to_json,
        content_type: :json,
        accept: :json
      )

      parsed_response = JSON.parse(response)
    end

    private

    def post(resource, options)
      uri = gen_uri(resource)

      response = RestClient.post(uri, options)

      content = JSON.parse(response)
    end

    def gen_uri(resource)
      uri = URI.parse(BASE)
      uri.path = "/v1/#{resource}"
      uri.to_s
    end
  end
end
{'fraction_non_alphanumeric': 0.10891812865497076, 'fraction_numerical': 0.0029239766081871343, 'mean_word_length': 2.0087912087912088, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2723558', 'n_tokens_mistral': 462, 'n_tokens_neox': 444, 'n_words': 97}