Sha256: c5ff0c476c56cafad8c252cd49847bdcfab427ea73a964fb78fc8da323432839
Contents?: true
Size: 1.07 KB
Versions: 48
Compression:
Stored size: 1.07 KB
Contents
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'xeroizer') client = Xeroizer::PrivateApplication.new(ARGV[0], ARGV[1], ARGV[2]) base_path = File.expand_path(File.dirname(__FILE__)) if ARGV[3] models = [ARGV[3]] else models = %w(Account BrandingTheme Contact CreditNote Currency Employee Invoice Item ManualJournal Organisation Payment TaxRate TrackingCategory) end models.each do | model_name | model = client.send(model_name.to_sym) # List records = model.all File.open("#{base_path}/#{model_name.underscore.pluralize}.xml", "w") { | fp | fp.write model.response.response_xml } if %w(Contact CreditNote Invoice ManualJournal).include?(model_name) records.each do | summary_record | record = model.find(summary_record.id) File.open("#{base_path}/records/#{model_name.underscore}-#{record.id}.xml", "w") { | fp | fp.write model.response.response_xml } end record = model.find(records.first.id) File.open("#{base_path}/#{model_name.underscore.singularize}.xml", "w") { | fp | fp.write model.response.response_xml } end end
Version data entries
48 entries across 48 versions & 3 rubygems