def send_request(params)
      if @project_id
        params['projectId'] = @project_id
      end
      params['response'] = 'json'
      params['apiKey'] = @api_key

      params_arr = []
      params.sort.each { |elem|
        params_arr << elem[0].to_s + '=' + CGI.escape(elem[1].to_s).gsub('+', '%20').gsub(' ','%20')
      }
      data = params_arr.join('&')
      signature = OpenSSL::HMAC.digest('sha1', @secret_key, data.downcase)
      signature = Base64.encode64(signature).chomp
      signature = CGI.escape(signature)

      if @api_url.nil? || @api_url.empty?
        puts "Error: Please specify a valid API URL."
        exit 1
      end

      url = "#{@api_url}?#{data}&signature=#{signature}"
      Chef::Log.debug("URL: #{url}")
      uri = URI.parse(url)

      http = http_client_builder.new(uri.host, uri.port)

      if uri.scheme == "https"
        http.use_ssl = true
        # Still need to do some testing on SSL, so will fix this later
        if @no_ssl_verify
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        else
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
      end
      request = Net::HTTP::Get.new(uri.request_uri)
      response = http.request(request)

      if !response.is_a?(Net::HTTPOK) then
        case response.code
        when "432"
          puts "\n"
          puts "Error #{response.code}: Your account does not have the right to execute this command is locked or the command does not exist."
        else
          puts "Error #{response.code}: #{response.message}"
          puts JSON.pretty_generate(JSON.parse(response.body))
          puts "URL: #{url}"
        end
        exit 1
      end

      json = JSON.parse(response.body)
      json[params['command'].downcase + 'response']
    end
def send_request(params)
      if @project_id
        params['projectId'] = @project_id
      end
      params['response'] = 'json'
      params['apiKey'] = @api_key

      params_arr = []
      params.sort.each { |elem|
        params_arr << elem[0].to_s + '=' + CGI.escape(elem[1].to_s).gsub('+', '%20').gsub(' ','%20')
      }
      data = params_arr.join('&')
      signature = OpenSSL::HMAC.digest('sha1', @secret_key, data.downcase)
      signature = Base64.encode64(signature).chomp
      signature = CGI.escape(signature)

      if @api_url.nil? || @api_url.empty?
        puts "Error: Please specify a valid API URL."
        exit 1
      end

      url = "#{@api_url}?#{data}&signature=#{signature}"
      Chef::Log.debug("URL: #{url}")
      uri = URI.parse(url)

      http = http_client_builder.new(uri.host, uri.port)

      if uri.scheme == "https"
        http.use_ssl = true
        # Still need to do some testing on SSL, so will fix this later
        if @no_ssl_verify
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        else
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end
      end
      request = Net::HTTP::Get.new(uri.request_uri)
      response = http.request(request)

      if !response.is_a?(Net::HTTPOK) then
        case response.code
        when "432"
          puts "\n"
          puts "Error #{response.code}: Your account does not have the right to execute this command is locked or the command does not exist."
        else
          puts "Error #{response.code}: #{response.message}"
          puts JSON.pretty_generate(JSON.parse(response.body))
          puts "URL: #{url}"
        end
        exit 1
      end

      json = JSON.parse(response.body)
      json[params['command'].downcase + 'response']
    end
Sends a synchronous request to the CloudStack API and returns the response as a Hash.

 The wrapper element of the response (e.g. mycommandresponse) is discarded and the
 contents of that element are returned.