From ed30a3118da722e8d89197d266b8fea584756205 Mon Sep 17 00:00:00 2001 From: Ben Jansen Date: Mon, 25 Nov 2019 14:56:36 -0800 Subject: [PATCH] Fix builds() in the case where the application has no build field --- lib/veracode/api/builds.rb | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/veracode/api/builds.rb b/lib/veracode/api/builds.rb index 2254549..af956a1 100644 --- a/lib/veracode/api/builds.rb +++ b/lib/veracode/api/builds.rb @@ -77,18 +77,19 @@ def cots? end def builds - @builds ||= [] - if @builds.empty? - if @xml_hash.build.class == Array - @builds = @xml_hash.build.map do |build| - Build.new(build) + @builds ||= + if @xml_hash.include?('build') + if @xml_hash.build.class == Array + @builds = @xml_hash.build.map do |build| + Build.new(build) + end + else + @builds = [Build.new(@xml_hash.build)] + end + else + [] end - else - @builds << Build.new(@xml_hash.build) - end - end - return @builds - end + end end class Applications < Veracode::Common::Base