lib/rbovirt.rb in rbovirt-0.0.13 vs lib/rbovirt.rb in rbovirt-0.0.14
- old
+ new
@@ -43,15 +43,16 @@
@cluster_id = cluster_id
@api_entrypoint = api_entrypoint
end
def api_version
+ return @api_version unless @api_version.nil?
xml = http_get("/")/'/api/product_info/version'
- (xml/'version').first[:major] +"."+ (xml/'version').first[:minor]
+ @api_version = (xml/'version').first[:major] +"."+ (xml/'version').first[:minor]
end
- def api_version?(major)
- api_version.split('.')[0] == major
+ def api_version?(major, minor=nil)
+ (api_version.split('.')[0] == major) && (minor.nil? ? true : api_version.split('.')[1] == minor)
end
def floppy_hook?
xml = http_get("/capabilities")
!(xml/"version/custom_properties/custom_property[@name='floppyinject']").empty?