def submit
      raise EbayTraderError, 'Cannot post an eBay API request before application keys have been set' unless EbayTrader.configuration.has_keys_set?

      uri = EbayTrader.configuration.uri

      http = Net::HTTP.new(uri.host, uri.port)
      http.read_timeout = http_timeout

      if uri.port == 443
        # http://www.rubyinside.com/nethttp-cheat-sheet-2940.html
        http.use_ssl = true
        verify = EbayTrader.configuration.ssl_verify
        if verify
          if verify.is_a?(String)
            pem = File.read(verify)
            http.cert = OpenSSL::X509::Certificate.new(pem)
            http.key = OpenSSL::PKey::RSA.new(pem)
          end
          http.verify_mode = OpenSSL::SSL::VERIFY_PEER
        else
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end

      end

      post = Net::HTTP::Post.new(uri.path, headers)
      post.body = xml_request

      begin
        response = http.start { |http| http.request(post) }
      rescue OpenSSL::SSL::SSLError => e
        # SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
        raise EbayTraderError, e
      rescue Net::ReadTimeout
        raise EbayTraderTimeoutError, "Failed to complete #{call_name} in #{http_timeout} seconds"
      rescue Exception => e
        raise EbayTraderError, e
      ensure
        EbayTrader.configuration.counter_callback.call if EbayTrader.configuration.has_counter?
      end

      @http_response_code = response.code.to_i.freeze

      # If the call was successful it should have a response code starting with '2'
      # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
      raise EbayTraderError, "HTTP Response Code: #{http_response_code}" unless http_response_code.between?(200, 299)

      if response['Content-Encoding'] == 'gzip'
        @xml_response = ActiveSupport::Gzip.decompress(response.body)
      else
        @xml_response = response.body
      end
    end
def submit
      raise EbayTraderError, 'Cannot post an eBay API request before application keys have been set' unless EbayTrader.configuration.has_keys_set?

      uri = EbayTrader.configuration.uri

      http = Net::HTTP.new(uri.host, uri.port)
      http.read_timeout = http_timeout

      if uri.port == 443
        # http://www.rubyinside.com/nethttp-cheat-sheet-2940.html
        http.use_ssl = true
        verify = EbayTrader.configuration.ssl_verify
        if verify
          if verify.is_a?(String)
            pem = File.read(verify)
            http.cert = OpenSSL::X509::Certificate.new(pem)
            http.key = OpenSSL::PKey::RSA.new(pem)
          end
          http.verify_mode = OpenSSL::SSL::VERIFY_PEER
        else
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end

      end

      post = Net::HTTP::Post.new(uri.path, headers)
      post.body = xml_request

      begin
        response = http.start { |http| http.request(post) }
      rescue OpenSSL::SSL::SSLError => e
        # SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
        raise EbayTraderError, e
      rescue Net::ReadTimeout
        raise EbayTraderTimeoutError, "Failed to complete #{call_name} in #{http_timeout} seconds"
      rescue Exception => e
        raise EbayTraderError, e
      ensure
        EbayTrader.configuration.counter_callback.call if EbayTrader.configuration.has_counter?
      end

      @http_response_code = response.code.to_i.freeze

      # If the call was successful it should have a response code starting with '2'
      # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
      raise EbayTraderError, "HTTP Response Code: #{http_response_code}" unless http_response_code.between?(200, 299)

      if response['Content-Encoding'] == 'gzip'
        @xml_response = ActiveSupport::Gzip.decompress(response.body)
      else
        @xml_response = response.body
      end
    end
Post the xml_request to eBay and record the xml_response.