Class: Pluginscan::WPVulnDB::APIResponseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/pluginscan/reports/vulnerability_report/wp_vuln_db_api.rb

Instance Method Summary collapse

Instance Method Details

#call(response, plugin_slug) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/pluginscan/reports/vulnerability_report/wp_vuln_db_api.rb', line 29

def call(response, plugin_slug)
  case response.code
  when 200
    DataMapper.new.call(response.parsed_response, plugin_slug)
  when 404
    []
  when 403
    raise(AccessDeniedError, "We got blocked by wpvulndb for suspicious activity :( Contact [email protected]")
  else
    raise(APIError, "Something went wrong when calling wpvulndb - got a #{response.code} code: '#{response.body[0..50]}'")
  end
end