<commit_before>module Petstore
  class Request
    require 'active_model'

    include ActiveModel::Validations

    attr_reader :conn, :partial_path, :method, :params

    validates_presence_of :conn, :partial_path, :method

    def initialize(options = {})
      @conn = options[:conn]
      @partial_path = options[:partial_path]
      @method = options[:method]
      @params = options[:params]
    end
    
    def make
      case @method
      when :get
        get
      when :post
        post
      when :delete
        delete
      when :put
        put
      end
    end

    private

    def get
      @conn.get @partial_path, @params
    end

    def post
      @conn.post @partial_path, @params do |req|
        req.headers['Content-Type'] = 'application/json'
      end
    end

    def delete
      @conn.delete @partial_path, @params
    end

    def put
      @conn.put @partial_path, @params do |req|
        req.headers['Content-Type'] = 'application/json'
      end
    end

  end
  
end<commit_msg>Add a patch method.<commit_after>module Petstore
  class Request
    require 'active_model'

    include ActiveModel::Validations

    attr_reader :conn, :partial_path, :method, :params

    validates_presence_of :conn, :partial_path, :method

    def initialize(options = {})
      @conn = options[:conn]
      @partial_path = options[:partial_path]
      @method = options[:method]
      @params = options[:params]
    end
    
    def make
      case @method
      when :get
        get
      when :post
        post
      when :delete
        delete
      when :put
        put
      when :patch
        patch
      end
    end

    private

    def get
      @conn.get @partial_path, @params
    end

    def post
      @conn.post @partial_path, @params do |req|
        req.headers['Content-Type'] = 'application/json'
      end
    end

    def delete
      @conn.delete @partial_path, @params
    end

    def put
      @conn.put @partial_path, @params do |req|
        req.headers['Content-Type'] = 'application/json'
      end
    end

    def patch
      @conn.patch @partial_path, @params do |req|
        req.headers['Content-Type'] = 'application/json'
      end
    end

  end
  
end
{'fraction_non_alphanumeric': 0.09242560865644725, 'fraction_numerical': 0.0, 'mean_word_length': 2.019047619047619, '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': '3707392', 'n_tokens_mistral': 684, 'n_tokens_neox': 664, 'n_words': 182}