Sha256: 0ff3f7e7fea93883a6ddbdff4ba2910f111e5c190ed9e9e35f77f86466a4836b

Contents?: true

Size: 902 Bytes

Versions: 5

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true

require 'json'

module Yawast
  module Scanner
    module Plugins
      module SSL
        module SSLLabs
          class Info
            def self.call_info(endpoint)
              uri = endpoint.copy
              uri.path = '/api/v3/info'

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

              body
            end

            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
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yawast-0.7.2 lib/scanner/plugins/ssl/ssl_labs/info.rb
yawast-0.7.1 lib/scanner/plugins/ssl/ssl_labs/info.rb
yawast-0.7.0 lib/scanner/plugins/ssl/ssl_labs/info.rb
yawast-0.7.0.beta3 lib/scanner/plugins/ssl/ssl_labs/info.rb
yawast-0.7.0.beta2 lib/scanner/plugins/ssl/ssl_labs/info.rb