Method: Auspaynet::Client#list

Defined in:
lib/auspaynet/client.rb

#list(dir:, matching_filename:, file_format: 'csv') ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/auspaynet/client.rb', line 23

def list(dir:, matching_filename:, file_format: 'csv')
  @ftp.chdir(dir)
  files = @ftp.nlst.select do |f|
    f.include?(matching_filename) &&
      f.include?(file_format) &&
      f.include?(current_year)
  end

  extract_latest_files(files: files, file_format: file_format)
ensure
  @ftp.chdir('/')
end