class SslLabs::Endpoint

Constants

ATTRS

Public Class Methods

from_hash(hash) click to toggle source
# File lib/ssl_labs/endpoint.rb, line 27
def self.from_hash(hash)
  endpoint = self.new
  hash.each do |k, v|
    sym = Util.underscore(k).to_sym
    case sym
    when :ip_address
      endpoint.ip_address = IPAddr.new(v)
    when *ATTRS
      endpoint.send("#{sym}=", v)
    else
      raise ArgumentError, "Unknown key #{k.inspect} (#{sym.inspect})"
    end
  end
  endpoint
end