class Resources::AvailableFile
Public Instance Methods
list()
click to toggle source
# File lib/pvdgm-svc-client/resources/available_file.rb, line 8 def list tp_id = third_party_id sd_id = service_definition_id ca_id = configured_account_id puts status = prompter.choose do | menu | menu.prompt = "Select the status to filter with: " menu.choice('All', 'Specify no status') { -1 } menu.choice('Available', 'All files that are ready to be pulled from the source') { 0 } menu.choice('Downloaded', 'All files that have been downloaded from the source') { 1 } menu.choice('Invalid', 'All files that have been marked as invalid') { 2 } menu.choice('Missing', 'All files that could not be found on the file system') { 3 } menu.choice('Uploaded', 'All files that have been uploaded to abaqis') { 4 } menu.choice('Upload Error', 'All files that had an error uploading to abaqis') { 5 } menu.choice('Deleted', 'All files that have been deleted from the file system') { 6 } menu.choice('Cleared', 'All files that have been cleared from the source') { 7 } menu.choice('Not Cleared', 'All files that have not been cleared') { 0x17 } end filter = status >= 0 ? "?status=#{status}" : '' result = get("services/third_parties/#{tp_id}/service_definitions/#{sd_id}/configured_accounts/#{ca_id}/available_files#{filter}") puts "\nAvailable files for third party: #{tp_id}, service definition: #{sd_id}" table = Terminal::Table.new headings: [ 'Request ID', 'File Name', 'Status', 'Downloaded At', 'CMP File Name', 'Error' ] do |t| result.each do | available_file | t << [ available_file['request_id'], available_file['filename'], available_file['status'], available_file['downloaded_at'], available_file['composite_file_name'], available_file['error'], available_file['created_at'], available_file['updated_at'] ] end end prompter.say table.to_s puts end