<commit_before>module Fog
  module Google
    class StorageJSON
      class Real
        # Get an object from Google Storage
        #
        # ==== Parameters
        # * bucket_name<~String> - Name of bucket to read from
        # * object_name<~String> - Name of object to read
        # * options<~Hash>:
        #   * 'If-Match'<~String> - Returns object only if its etag matches this value, otherwise returns 412 (Precondition Failed).
        #   * 'If-Modified-Since'<~Time> - Returns object only if it has been modified since this time, otherwise returns 304 (Not Modified).
        #   * 'If-None-Match'<~String> - Returns object only if its etag differs from this value, otherwise returns 304 (Not Modified)
        #   * 'If-Unmodified-Since'<~Time> - Returns object only if it has not been modified since this time, otherwise returns 412 (Precodition Failed).
        #   * 'Range'<~String> - Range of object to download
        #   * 'versionId'<~String> - specify a particular version to retrieve
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~String> - Contents of object
        #   * headers<~Hash>:
        #     * 'Content-Length'<~String> - Size of object contents
        #     * 'Content-Type'<~String> - MIME type of object
        #     * 'ETag'<~String> - Etag of object
        #     * 'Last-Modified'<~String> - Last modified timestamp for object
        #
        def get_object(bucket_name, object_name, _options = {}, &_block)
          raise ArgumentError.new("bucket_name is required") unless bucket_name
          raise ArgumentError.new("object_name is required") unless object_name

          api_method = @storage_json.objects.get
          parameters = {
            "bucket" => bucket_name,
            "object" => object_name
          }

          object = request(api_method, parameters)

          # Get the body of the object (can't use request for this)
          parameters["alt"] = "media"
          client_parms = {
            :api_method => api_method,
            :parameters => parameters
          }

          result = @client.execute(client_parms)
          object.body = result.body.nil? || result.body.empty? ? nil : result.body
          
          object

          # params = { :headers => {} }
          # if version_id = options.delete("versionId")
          #   params[:query] = { "versionId" => version_id }
          # end
          # params[:headers].merge!(options)
          # if options["If-Modified-Since"]
          #   params[:headers]["If-Modified-Since"] = Fog::Time.at(options["If-Modified-Since"].to_i).to_date_header
          # end
          # if options["If-Modified-Since"]
          #   params[:headers]["If-Unmodified-Since"] = Fog::Time.at(options["If-Unmodified-Since"].to_i).to_date_header
          # end

          # params[:response_block] = Proc.new if block_given?

          # request(params.merge!(:expects        => 200,<commit_msg>Add object properties as header instead of in body<commit_after>module Fog
  module Google
    class StorageJSON
      class Real
        # Get an object from Google Storage
        #
        # ==== Parameters
        # * bucket_name<~String> - Name of bucket to read from
        # * object_name<~String> - Name of object to read
        # * options<~Hash>:
        #   * 'If-Match'<~String> - Returns object only if its etag matches this value, otherwise returns 412 (Precondition Failed).
        #   * 'If-Modified-Since'<~Time> - Returns object only if it has been modified since this time, otherwise returns 304 (Not Modified).
        #   * 'If-None-Match'<~String> - Returns object only if its etag differs from this value, otherwise returns 304 (Not Modified)
        #   * 'If-Unmodified-Since'<~Time> - Returns object only if it has not been modified since this time, otherwise returns 412 (Precodition Failed).
        #   * 'Range'<~String> - Range of object to download
        #   * 'versionId'<~String> - specify a particular version to retrieve
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~String> - Contents of object
        #   * headers<~Hash>:
        #     * 'Content-Length'<~String> - Size of object contents
        #     * 'Content-Type'<~String> - MIME type of object
        #     * 'ETag'<~String> - Etag of object
        #     * 'Last-Modified'<~String> - Last modified timestamp for object
        #
        def get_object(bucket_name, object_name, _options = {}, &_block)
          raise ArgumentError.new("bucket_name is required") unless bucket_name
          raise ArgumentError.new("object_name is required") unless object_name

          api_method = @storage_json.objects.get
          parameters = {
            "bucket" => bucket_name,
            "object" => object_name
          }

          object = request(api_method, parameters)

          # Get the body of the object (can't use request for this)
          parameters["alt"] = "media"
          client_parms = {
            :api_method => api_method,
            :parameters => parameters
          }

          result = @client.execute(client_parms)
          object.headers = object.body
          object.body = result.body.nil? || result.body.empty? ? nil : result.body
          object

          # params = { :headers => {} }
          # if version_id = options.delete("versionId")
          #   params[:query] = { "versionId" => version_id }
          # end
          # params[:headers].merge!(options)
          # if options["If-Modified-Since"]
          #   params[:headers]["If-Modified-Since"] = Fog::Time.at(options["If-Modified-Since"].to_i).to_date_header
          # end
          # if options["If-Modified-Since"]
          #   params[:headers]["If-Unmodified-Since"] = Fog::Time.at(options["If-Unmodified-Since"].to_i).to_date_header
          # end

          # params[:response_block] = Proc.new if block_given?

          # request(params.merge!(:expects        => 200,
{'fraction_non_alphanumeric': 0.1183225162256615, 'fraction_numerical': 0.004992511233150275, 'mean_word_length': 2.174854727945061, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3515259', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1643, 'n_words': 437}