def add_optional_param(key, value, params, call_params)
      # if there is no value in optional param spec,
      # then only add optional param that is set in call parameters
      if !value
        params[-1][key.to_sym] = call_params[key.to_sym] if call_params.key? key.to_sym
      # if value is provided in optional param spec,
      # then apply variable interpolation the same way as required param
      elsif value.class == String
        case value
        when '__FILE_PACKAGE__'
          file_path = "#{call_params[:file_path]}/#{call_params[:package_name]}-#{call_params[:package_version]}.zip"
        when '__FILE_PLAIN__'
          file_path = call_params[:file_path]
        when '__FILE_CERTIFICATE__'
          file_path = call_params[:file_path_certificate]
        when '__FILE_PRIVATE_KEY__'
          file_path = call_params[:file_path_private_key]
        end

        if !file_path.nil?
          File.open(file_path.to_s, 'r') { |file|
            params[-1][key.to_sym] = file
          }
        else
          params[-1][key.to_sym] = value % call_params
        end
      else
        params[-1][key.to_sym] = value
      end
    end
def add_optional_param(key, value, params, call_params)
      # if there is no value in optional param spec,
      # then only add optional param that is set in call parameters
      if !value
        params[-1][key.to_sym] = call_params[key.to_sym] if call_params.key? key.to_sym
      # if value is provided in optional param spec,
      # then apply variable interpolation the same way as required param
      elsif value.class == String
        case value
        when '__FILE_PACKAGE__'
          file_path = "#{call_params[:file_path]}/#{call_params[:package_name]}-#{call_params[:package_version]}.zip"
        when '__FILE_PLAIN__'
          file_path = call_params[:file_path]
        when '__FILE_CERTIFICATE__'
          file_path = call_params[:file_path_certificate]
        when '__FILE_PRIVATE_KEY__'
          file_path = call_params[:file_path_private_key]
        end

        if !file_path.nil?
          File.open(file_path.to_s, 'r') { |file|
            params[-1][key.to_sym] = file
          }
        else
          params[-1][key.to_sym] = value % call_params
        end
      else
        params[-1][key.to_sym] = value
      end
    end
Add optional param into params list.

 @param key optional param key
 @param value optional param value
 @param params combined list of required and optional parameters
 @param call_params API call parameters