server.rb
643 Bytes
class Lxd::Server
include ActiveModel::Model
attr_accessor :api_extensions, :api_status, :api_version, :auth, :config,
:environment, :public
def self.by_host(host, certificate)
all = Array.new;
uri = URI.parse(host.uri + '/1.0')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.cert = OpenSSL::X509::Certificate.new(certificate.cert)
http.key = OpenSSL::PKey::RSA.new(certificate.key)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
Lxd::Server.new(JSON.parse(response.body)['metadata'])
end
end
# vim: set ts=2 sw=2: