Get files

Method get_files is used for downloading invoice XML files.

Return value(s)

This method returns an zip file containing the files as SOAP attachment.

Authentication

This method requires that you have registered to Maventa and received the API key.

Arguments

  1. api key string (required)
  2. vendor api key string (required)
  3. XML format string (optional) If string is not given, only invoices attachments are returned.

Example code

 1   require 'soap/rpc/driver'
 2   require 'soap/attachment'
 3 
 4   driver = SOAP::RPC::Driver.new('https://trx.maventa.com/', 'files')
 5   driver.add_method('get_files', 'api_key', 'invoice_id', 'xmlformat')
 6 
 7   api_key = "" # put here your personal API key.
 8   invoice_id = "" # put here id of the wanted invoice
 9   xmlformat = "" 
10 
11   incoming_file = driver.get_files(api_key, invoice_id, xmlformat)
12 
13   begin
14     File.open("#{invoice_id}_files.zip", 'wb') do |f|
15         f << incoming_file.values
16     end
17 
18     puts "OK: FILES RECEIVED SUCCESSFULLY" 
19   rescue
20     puts "ERROR: COULD NOT RECEIVE FILES" 
21   end

Also available in: HTML TXT