Module: VeracodeApiMacros

Includes:
VeracodeApiResults, VeracodeApiScan
Defined in:
lib/veracodecli/api.rb

Overview

Macros module. Contains sequenced method calls from above modules to perform actions such as submitting scans, retreiving reports.

Instance Method Summary collapse

Methods included from VeracodeApiResults

#get_most_recent_build_id, #get_prescan_results, #get_scan_report, #get_scan_report_pdf

Methods included from VeracodeApiBase

#get_repo_archive, #parse_new_app_id, #response_parse_app_id, #veracode_api_request

Methods included from VeracodeApiScan

#create_app_profile, #get_app_id, #submit_prescan, #upload_file

Instance Method Details

#get_pdf_macro(app_name) ⇒ Object



147
148
149
150
151
152
153
154
155
156
# File 'lib/veracodecli/api.rb', line 147

def get_pdf_macro(app_name)
  app_id = get_app_id app_name
  build_id = get_most_recent_build_id app_id
  report = get_scan_report_pdf build_id
  file_path = "/tmp/#{build_id}_report.pdf"
  file = File.open file_path, 'w+'
  file.write report
  file.close
  return file_path
end

#get_report_macro(app_name) ⇒ Object



141
142
143
144
145
# File 'lib/veracodecli/api.rb', line 141

def get_report_macro(app_name)
  app_id = get_app_id app_name
  build_id = get_most_recent_build_id app_id
  p get_scan_report build_id
end

#submit_scan_macro(app_name, business_criticality, business_unit, team) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
# File 'lib/veracodecli/api.rb', line 129

def submit_scan_macro(app_name, business_criticality, business_unit, team)
  archive_path = "/tmp/sast_upload.zip"
  app_id = get_app_id(app_name)
  if app_id.nil?
    app_id = create_app_profile(app_name, business_criticality, business_unit, team)
  end
  upload = upload_file app_id, archive_path
  ResponseLogger.new('/tmp').log 'uploadfile.do', '', upload
  submit_prescan app_id
  File.delete archive_path
end