<commit_before>module SmoothOperator
  module HttpHandlers
    module Typhoeus

      class ORM

        attr_reader :object_class

        def initialize(object_class)
          @object_class = object_class
        end

        def find_each(options, &block)
          make_the_call(:get, options, '') do |remote_call|
            yield(remote_call)
          end
        end

        def find_one(id, options, &block)
          make_the_call(:get, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        def create(options, &block)
          make_the_call(:post, options, '') do |remote_call|
            yield(remote_call)
          end
        end

        def update(id, options, &block)
          make_the_call(:put, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        def destroy(id, options, &block)
          make_the_call(:delete, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        # THIS SHOULD NOT BE HERE!
        def rollback(id, options, &block)
          make_the_call(:post, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        private ############################# private ############################

        def make_the_call(http_verb, options, id, &block)
          injected_hydra = options[:hydra]
          options[:hydra] = injected_hydra || ::Typhoeus::Hydra.hydra

          remote_call = @object_class.make_the_call(http_verb, id, options)

          remote_call.request.on_complete do |typhoeus_response|
            remote_call.raw_response = typhoeus_response
            yield(remote_call)
          end
          
          remote_call.request.run if injected_hydra.blank?<commit_msg>changed the rollback http verb to delete<commit_after>module SmoothOperator
  module HttpHandlers
    module Typhoeus

      class ORM

        attr_reader :object_class

        def initialize(object_class)
          @object_class = object_class
        end

        def find_each(options, &block)
          make_the_call(:get, options, '') do |remote_call|
            yield(remote_call)
          end
        end

        def find_one(id, options, &block)
          make_the_call(:get, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        def create(options, &block)
          make_the_call(:post, options, '') do |remote_call|
            yield(remote_call)
          end
        end

        def update(id, options, &block)
          make_the_call(:put, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        def destroy(id, options, &block)
          make_the_call(:delete, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        # THIS SHOULD NOT BE HERE!
        def rollback(id, options, &block)
          make_the_call(:delete, options, id) do |remote_call|
            yield(remote_call)
          end
        end

        private ############################# private ############################

        def make_the_call(http_verb, options, id, &block)
          injected_hydra = options[:hydra]
          options[:hydra] = injected_hydra || ::Typhoeus::Hydra.hydra

          remote_call = @object_class.make_the_call(http_verb, id, options)

          remote_call.request.on_complete do |typhoeus_response|
            remote_call.raw_response = typhoeus_response
            yield(remote_call)
          end
          
          remote_call.request.run if injected_hydra.blank?
{'fraction_non_alphanumeric': 0.10695483513438625, 'fraction_numerical': 0.0, 'mean_word_length': 2.000831255195345, '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': '7143742', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1019, 'n_words': 233}