Class: Yawast::Scanner::Plugins::SSL::SSLLabs::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/scanner/plugins/ssl/ssl_labs/info.rb

Class Method Summary collapse

Class Method Details

.call_info(endpoint) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/scanner/plugins/ssl/ssl_labs/info.rb', line 11

def self.call_info(endpoint)
  uri = endpoint.copy
  uri.path = '/api/v3/info'

  body = Yawast::Shared::Http.get uri

  body
end

.extract_msg(body) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/scanner/plugins/ssl/ssl_labs/info.rb', line 20

def self.extract_msg(body)
  ret = []

  begin
    json = JSON.parse body
  rescue => e # rubocop:disable Style/RescueStandardError
    raise Exception, "Invalid response from SSL Labs: '#{e.message}'"
  end

  unless json['messages'].nil?
    json['messages'].each do |msg|
      ret.push msg
    end
  end

  ret
end