Class: VtApi::ApiV2::URL
- Inherits:
-
Object
- Object
- VtApi::ApiV2::URL
- Defined in:
- lib/vt_api/api/v2/url.rb
Overview
Class that represents URL scan report.
Instance Attribute Summary collapse
-
#filescan_id ⇒ Object
readonly
Returns the value of attribute filescan_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#permalink ⇒ Object
readonly
Returns the value of attribute permalink.
-
#scan_date ⇒ Object
readonly
Returns the value of attribute scan_date.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.from_response(api_resp) ⇒ Object
Shorthand for #initialize.
-
.report(resource:, scan: false) ⇒ URL
URL report object is present,
nil
otherwise. -
.schedule_scan(url:) ⇒ String
Scheduled scan ID.
Instance Method Summary collapse
-
#initialize(api_resp) ⇒ URL
constructor
Initializes new object from VT API response.
Constructor Details
#initialize(api_resp) ⇒ URL
Direct creation of object cas cause errors since it doesn’t contain any validity checks. Use predefined API method bindings instead.
Initializes new object from VT API response.
58 59 60 61 62 |
# File 'lib/vt_api/api/v2/url.rb', line 58 def initialize(api_resp) load_id!(api_resp) (api_resp) load_scans!(api_resp) end |
Instance Attribute Details
#filescan_id ⇒ Object (readonly)
Returns the value of attribute filescan_id.
48 49 50 |
# File 'lib/vt_api/api/v2/url.rb', line 48 def filescan_id @filescan_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
48 49 50 |
# File 'lib/vt_api/api/v2/url.rb', line 48 def id @id end |
#permalink ⇒ Object (readonly)
Returns the value of attribute permalink.
48 49 50 |
# File 'lib/vt_api/api/v2/url.rb', line 48 def permalink @permalink end |
#scan_date ⇒ Object (readonly)
Returns the value of attribute scan_date.
48 49 50 |
# File 'lib/vt_api/api/v2/url.rb', line 48 def scan_date @scan_date end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
48 49 50 |
# File 'lib/vt_api/api/v2/url.rb', line 48 def url @url end |
Class Method Details
.from_response(api_resp) ⇒ Object
Shorthand for #initialize.
38 39 40 41 42 43 44 45 46 |
# File 'lib/vt_api/api/v2/url.rb', line 38 def self.from_response(api_resp) # noinspection RubyResolve if api_resp.response_code.nil? || (api_resp.response_code < 1) nil else report = new api_resp report end end |
.report(resource:, scan: false) ⇒ URL
Returns URL report object is present, nil
otherwise.
16 17 18 19 20 21 22 23 |
# File 'lib/vt_api/api/v2/url.rb', line 16 def report(resource:, scan: false) resp = ApiV2.provider.request 'url.report', apikey: VtApi..token, resource: resource, schedule_scan: (scan ? 1 : 0) pp resp from_response resp end |