lib/updateagent/updateagent.rb in onebody-updateagent-0.4.1 vs lib/updateagent/updateagent.rb in onebody-updateagent-0.4.2
- old
+ new
@@ -110,12 +110,12 @@
end
def present_record(row, new=false)
puts "#{row['legacy_id'].to_s.ljust(10)} #{name_for(row).to_s.ljust(40)} #{new ? '(new)' : ' '}"
if DEBUG
- puts row.values_hash(@attributes)
- puts row['remote_hash']
+ puts "Local values: #{row.values_for_hash(@attributes).join}"
+ puts "Remote values: #{row['remote_hash']}"
end
end
def confirm
agree('Do you want to continue, pushing these records to OneBody? ')
@@ -126,10 +126,10 @@
@errors = []
puts 'Updating remote end...'
index = 0
print "#{resource.name} 0/0\r"; STDOUT.flush
(@create + @update).each_slice(MAX_TO_BATCH_AT_A_TIME) do |records|
- response = resource.post(:batch, {}, records.to_xml)
+ response = resource.post(:batch, {}, {:options => @options['remote_options'], :records => records}.to_xml)
statuses = Hash.from_xml(response.body)['records']
statuses.each do |status|
record = data_by_id[status['legacy_id']]
record['id'] = status['id']
record['name'] = status['name']