Class: WeBee::OVFPackage
- Inherits:
-
Object
- Object
- WeBee::OVFPackage
- Includes:
- SAXMachine, RestResource
- Defined in:
- lib/webee.rb
Class Method Summary collapse
-
.all(enterprise = 1) ⇒ Object
enterprise can be either 1 or an Enterprise object.
- .find(enterprise_id = 1, package_id = 1) ⇒ Object
Methods included from RestResource
Methods included from SAXMachine
Class Method Details
.all(enterprise = 1) ⇒ Object
enterprise can be either 1 or an Enterprise object
122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/webee.rb', line 122 def self.all(enterprise = 1) if enterprise.is_a? Enterprise enterprise_id = enterprise.resource_id else enterprise_id = enterprise end items = [] doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages", :accept => :xml)) doc.search('//ovfPackage').each do |node| items << OVFPackage.parse(node.to_s) end items end |
.find(enterprise_id = 1, package_id = 1) ⇒ Object
136 137 138 139 |
# File 'lib/webee.rb', line 136 def self.find(enterprise_id = 1, package_id = 1) doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages/#{package_id}", :accept => :xml)) OVFPackage.parse(doc.root.to_s) end |