Class: Resources::AvailableFile
- Inherits:
-
BaseResource
- Object
- BaseResource
- Resources::AvailableFile
- Defined in:
- lib/pvdgm-svc-client/resources/available_file.rb
Instance Attribute Summary
Attributes inherited from BaseResource
Instance Method Summary collapse
Methods included from ConfiguredAccountPrompter
Methods included from ServiceDefinitionPrompter
Methods included from ThirdPartyPrompter
Methods inherited from BaseResource
Constructor Details
This class inherits a constructor from BaseResource
Instance Method Details
#list ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# 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 | | .prompt = "Select the status to filter with: " .choice('All', 'Specify no status') { -1 } .choice('Available', 'All files that are ready to be pulled from the source') { 0 } .choice('Downloaded', 'All files that have been downloaded from the source') { 1 } .choice('Invalid', 'All files that have been marked as invalid') { 2 } .choice('Missing', 'All files that could not be found on the file system') { 3 } .choice('Uploaded', 'All files that have been uploaded to abaqis') { 4 } .choice('Upload Error', 'All files that had an error uploading to abaqis') { 5 } .choice('Deleted', 'All files that have been deleted from the file system') { 6 } .choice('Cleared', 'All files that have been cleared from the source') { 7 } .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 |