def get_bugs(bugs, fields = ::Bugzilla::Bug::FIELDS_SUMMARY)
params = {}
if bugs.kind_of?(Array) then
params['ids'] = bugs
elsif bugs.kind_of?(Integer) ||
bugs.kind_of?(String) then
params['ids'] = [bugs]
else
raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
end
unless fields.nil? then
unless (fields - ::Bugzilla::Bug::FIELDS_ALL).empty? then
raise ArgumentError, sprintf("Invalid fields: %s", (::Bugzilla::Bug::FIELDS_ALL - fields).join(' '))
end
params['include_fields'] = fields
end
result = get(params)
if fields.nil? || fields == ::Bugzilla::Bug::FIELDS_ALL then
get_comments(bugs).each do |id, c|
result['bugs'].each do |r|
if r['id'].to_s == id then
r['comments'] = c['comments']
r['comments'] = [] if r['comments'].nil?
break
end
end
end
end
result['bugs']
end