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

Version Path
xeroizer-3.0.1 test/stub_responses/refresh_responses.rb
xeroizer-3.0.0 test/stub_responses/refresh_responses.rb
xeroizer-3-pre-beta-3.0.0.pre.beta test/stub_responses/refresh_responses.rb
xeroizer-2.20.0 test/stub_responses/refresh_responses.rb
xeroizer-2.19.0 test/stub_responses/refresh_responses.rb
xeroizer-2.18.1 test/stub_responses/refresh_responses.rb
xeroizer-2.17.1 test/stub_responses/refresh_responses.rb
xeroizer-2.16.5 test/stub_responses/refresh_responses.rb
xeroizer-2.16.4 test/stub_responses/refresh_responses.rb
xeroizer-2.16.3 test/stub_responses/refresh_responses.rb
xeroizer-2.16.1 test/stub_responses/refresh_responses.rb
xeroizer-2.16.0 test/stub_responses/refresh_responses.rb
xeroizer-2.15.9 test/stub_responses/refresh_responses.rb
xeroizer-2.15.8 test/stub_responses/refresh_responses.rb
xeroizer-2.15.7 test/stub_responses/refresh_responses.rb
xeroizer-2.15.6 test/stub_responses/refresh_responses.rb
xeroizer-2.15.5 test/stub_responses/refresh_responses.rb
xeroizer-float-2.15.3.13 test/stub_responses/refresh_responses.rb
xeroizer-float-2.15.3.12 test/stub_responses/refresh_responses.rb
xeroizer-float-2.15.3.11 test/stub_responses/refresh_responses.rb