69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/lhbackup/backup.rb', line 69
def find_attachments(data)
print "- finding #{data.sum(&:attachments_count)} attachments"
attachment_data = data.map do |obj|
next if obj.attachments_count.zero?
attachments = Lighthouse::Ticket.find(obj.number, :params => {:project_id => @project.id}).attachments
putc '.'
attachments.each do |a|
if a.respond_to?(:url)
@attachments << a.url
elsif a.respond_to?(:image) && a.image.respond_to?(:url)
@attachments << a.image.url
else
puts "Whats the url for this attachment? #{a.to_json}"
end
end
{obj.number => attachments} end.compact
store(attachment_data, File.join(@folder, "ticket-attachments.json"))
end
|