Class: Threadfix::Client::Scans::Upload
- Inherits:
-
Object
- Object
- Threadfix::Client::Scans::Upload
- Defined in:
- lib/threadfix/client/scans/upload.rb
Constant Summary collapse
- API_VERSION =
'2.5'
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Upload
constructor
A new instance of Upload.
- #perform! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Upload
Returns a new instance of Upload.
12 13 14 15 |
# File 'lib/threadfix/client/scans/upload.rb', line 12 def initialize(={}) @file_path = [:file_path] @app_id = [:app_id] end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
10 11 12 |
# File 'lib/threadfix/client/scans/upload.rb', line 10 def app_id @app_id end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
10 11 12 |
# File 'lib/threadfix/client/scans/upload.rb', line 10 def file_path @file_path end |
Instance Method Details
#perform! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/threadfix/client/scans/upload.rb', line 17 def perform! begin r = RestClient.post( endpoint.to_s, { file: file }, { :accept => "application/json", :Authorization => "APIKEY #{apiKey}" } ) JSON.parse(r.body) rescue RestClient::NotFound => e puts "Endpoint not found (using API version: #{API_VERSION})" raise e rescue RestClient::ExceptionWithResponse => e raise e end end |