Skip to content

Commit

Permalink
Fix builds() in the case where the application has no build field
Browse files Browse the repository at this point in the history
  • Loading branch information
aogail committed Nov 25, 2019
1 parent 4d40d62 commit ed30a31
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/veracode/api/builds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed30a31

Please sign in to comment.