def create_smart_proxies_from_csv(line)
line[COUNT].to_i.times do |number|
name = namify(line[NAME], number)
if !@existing.include? line[URL]
print "Creating smart proxy '#{name}'..." if option_verbose?
id = @api.resource(:smart_proxies)\
.call(:create, {
'smart_proxy' => {
'name' => name,
'url' => line[URL]
}
})['id']
else
print "Updating smart proxy '#{name}'..." if option_verbose?
id = @api.resource(:smart_proxies)\
.call(:update, {
'id' => @existing[name],
'smart_proxy' => {
'name' => name,
'url' => line[URL]
}
})['smart_proxy']['id']
end
associate_organizations(id, line[ORGANIZATIONS], 'smart_proxy')
associate_locations(id, line[LOCATIONS], 'smart_proxy')
print "done\n" if option_verbose?
end
rescue RuntimeError => e
raise "#{e}\n #{line}"
end