You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: xcode_server_get_assets.rb
    path of file: ./repos/fastlane/fastlane/lib/fastlane/actions
    
    the code of the file until where you have to start completion: module Fastlane
  module Actions
    module SharedValues
      XCODE_SERVER_GET_ASSETS_PATH = :XCODE_SERVER_GET_ASSETS_PATH
      XCODE_SERVER_GET_ASSETS_ARCHIVE_PATH = :XCODE_SERVER_GET_ASSETS_ARCHIVE_PATH
    end

    class XcodeServerGetAssetsAction < Action
      require 'excon'
      require 'json'
      require 'fileutils'

      def self.run(params)
        host = params[:host]
        bot_name = params[:bot_name]
        integration_number_override = params[:integration_number]
        target_folder = params[:target_folder]
        keep_all_assets = params[:keep_all_assets]
        username = params[:username]
        password = params[:password]
        trust_self_signed_certs = params[:trust_self_signed_certs]

        # setup (not)trusting self signed certificates.
        # it's normal to have a self signed certificate on your Xcode Server
        Excon.defaults[:ssl_verify_peer] = !trust_self_signed_certs # for self-signed certificates

        # create Xcode Server config
        xcs = XcodeServer.new(host, username, password)
        bots = xcs.fetch_all_bots

        UI.important("Fetched #{bots.count} Bots from Xcode Server at #{host}.")

        # pull out names
        bot_names = bots.map { |bot| bot['name'] }

        # match the bot name with a found bot, otherwise fail
        found_bots = bots.select { |bot| bot['name'] == bot_name }
        UI.user_error!("Failed to find a Bot with name #{bot_name} on server #{host}, only available Bots: #{bot_names}") if found_bots.count == 0

        bot = found_bots[0]

        UI.success("Found Bot with name #{bot_name} with id #{bot['_id']}.")

        # we have our bot, get finished integrations, sorted from newest to oldest
        integrations = xcs.fetch_integrations(bot['_id']).select { |i| i['currentStep'] == 'completed' }
        UI.user_error!("Failed to find any completed integration for Bot \"#{bot_name}\"") if (integrations || []).count == 0

        # if no integration number is specified, pick the newest one (this is sorted from newest to oldest)
        if integration_number_override
          integration = integrations.find { |i| i['number'] == integration_number_override }
          UI.user_error!("Specified integration number #{integration_number_override} does not exist.") unless integration
        else
          integration = integrations.first
        end

        # consider: only taking the last successful one? or allow failing tests? warnings?

        UI.important("Using integration #{integration['number']}.")

        # fetch assets for this integration
        assets_path = xcs.fetch_assets(integration['_id'], target_folder, self)
        UI.user_error!("Failed to fetch assets for integration #{integration['number']}.") unless assets_path

        asset_entries = Dir.entries(assets_path).map { |i| File.join(assets_path, i) }

    
      def self.run(params)
        host = params[:host]
        bot_name = params[:bot_name]
        integration_number_override = params[:integration_number]
        target_folder = params[:target_folder]
        keep_all_assets = params[:keep_all_assets]
        username = params[:username]
        password = params[:password]
        trust_self_signed_certs = params[:trust_self_signed_certs]

        # setup (not)trusting self signed certificates.
        # it's normal to have a self signed certificate on your Xcode Server
        Excon.defaults[:ssl_verify_peer] = !trust_self_signed_certs # for self-signed certificates

        # create Xcode Server config
        xcs = XcodeServer.new(host, username, password)
        bots = xcs.fetch_all_bots

        UI.important("Fetched #{bots.count} Bots from Xcode Server at #{host}.")

        # pull out names
        bot_names = bots.map { |bot| bot['name'] }

        # match the bot name with a found bot, otherwise fail
        found_bots = bots.select { |bot| bot['name'] == bot_name }
        UI.user_error!("Failed to find a Bot with name #{bot_name} on server #{host}, only available Bots: #{bot_names}") if found_bots.count == 0

        bot = found_bots[0]

        UI.success("Found Bot with name #{bot_name} with id #{bot['_id']}.")

        # we have our bot, get finished integrations, sorted from newest to oldest
        integrations = xcs.fetch_integrations(bot['_id']).select { |i| i['currentStep'] == 'completed' }
        UI.user_error!("Failed to find any completed integration for Bot \"#{bot_name}\"") if (integrations || []).count == 0

        # if no integration number is specified, pick the newest one (this is sorted from newest to oldest)
        if integration_number_override
          integration = integrations.find { |i| i['number'] == integration_number_override }
          UI.user_error!("Specified integration number #{integration_number_override} does not exist.") unless integration
        else
          integration = integrations.first
        end

        # consider: only taking the last successful one? or allow failing tests? warnings?

        UI.important("Using integration #{integration['number']}.")

        # fetch assets for this integration
        assets_path = xcs.fetch_assets(integration['_id'], target_folder, self)
        UI.user_error!("Failed to fetch assets for integration #{integration['number']}.") unless assets_path

        asset_entries = Dir.entries(assets_path).map { |i| File.join(assets_path, i) }

        UI.success("Successfully downloaded #{asset_entries.count} assets to file #{assets_path}!")

        # now find the archive and unzip it
        zipped_archive_path = asset_entries.find { |i| i.end_with?('xcarchive.zip') }

        if zipped_archive_path

          UI.important("Found an archive in the assets folder...")

          archive_file_path = File.basename(zipped_archive_path, File.extname(zipped_archive_path))
          archive_dir_path = File.dirname(zipped_archive_path)
          archive_path = File.join(archive_dir_path, archive_file_path)
          if File.exist?(archive_path)
            # we already have the archive, skip
            UI.important("Archive #{archive_path} already exists, not unzipping again...")
          else
            # unzip the archive
            sh("unzip -q \"#{zipped_archive_path}\" -d \"#{archive_dir_path}\"")
          end

          # reload asset entries to also contain the xcarchive file
          asset_entries = Dir.entries(assets_path).map { |i| File.join(assets_path, i) }

          # optionally delete everything except for the archive
          unless keep_all_assets
            files_to_delete = asset_entries.select do |i|
              File.extname(i) != '.xcarchive' && ![".", ".."].include?(File.basename(i))
            end

            files_to_delete.each do |i|
              FileUtils.rm_rf(i)
            end
          end