class StudioApi::Gallery::Appliance
Public Instance Methods
background()
click to toggle source
Retrieves content of background image
# File lib/studio_api/gallery.rb 69 def background 70 request_str = "/gallery/appliances/#{id.to_i}/background" 71 response = GenericRequest.new(self.class.studio_connection).get request_str 72 end
comments()
click to toggle source
Retrieves all comments to appliance @return [Array] list of comments
# File lib/studio_api/gallery.rb 85 def comments 86 request_str = "/gallery/appliances/#{id.to_i}/comments" 87 response = GenericRequest.new(self.class.studio_connection).get request_str 88 tree = XmlSimple.xml_in response, "ForceArray" => ["comment"] 89 tree["appliance"]["comments"]["comment"].collect do |c| 90 Comment.parse(self,c) 91 end 92 end
logo()
click to toggle source
Retrieves content of logo image
# File lib/studio_api/gallery.rb 63 def logo 64 request_str = "/gallery/appliances/#{id.to_i}/logo" 65 response = GenericRequest.new(self.class.studio_connection).get request_str 66 end
post_comment(text, options={})
click to toggle source
Adds new comment to appliance
# File lib/studio_api/gallery.rb 95 def post_comment text, options={} 96 request_str = "/gallery/appliances/#{id.to_i}/comments" 97 request_str = Util.add_options request_str, options 98 response = GenericRequest.new(self.class.studio_connection).post request_str, :__raw => text 99 tree = XmlSimple.xml_in response, "ForceArray" => ["comment"] 100 tree["appliance"]["comments"]["comment"].collect do |c| 101 Comment.parse(self,c) 102 end 103 end
rate(value)
click to toggle source
Posts own rating of appliance @param value in range 0..5 @return TODO
# File lib/studio_api/gallery.rb 27 def rate value 28 request_str = "/gallery/appliances/#{id.to_i}/rating?rating=#{value.to_i}" 29 response = GenericRequest.new(self.class.studio_connection).post request_str 30 XmlSimple.xml_in(response, "ForceArray" => false)["appliance"] 31 end
rating()
click to toggle source
Gets rating details as hash return[Hash] TODO
# File lib/studio_api/gallery.rb 18 def rating 19 request_str = "/gallery/appliances/#{id.to_i}/rating" 20 response = GenericRequest.new(self.class.studio_connection).get request_str 21 XmlSimple.xml_in(response, "ForceArray" => false)["appliance"] 22 end
release_notes=(text)
click to toggle source
Modifies appliance release notes @param text of release notes
# File lib/studio_api/gallery.rb 35 def release_notes= (text) 36 request_str = "/gallery/appliances/#{id.to_i}/version/#{CGI.escape version.to_s}" 37 response = GenericRequest.new(studio_connection).put request_str, :__raw => release_notes 38 end
software(options = {})
click to toggle source
Retrieves information about software used to create appliance
# File lib/studio_api/gallery.rb 55 def software options = {} 56 request_str = "/gallery/appliances/#{id.to_i}/software" 57 request_str = Util.add_options request_str, options 58 response = GenericRequest.new(self.class.studio_connection).get request_str 59 #TODO parse response to something usefull 60 end
testdrive(options = {})
click to toggle source
Starts testdrive and gets information how to use it
# File lib/studio_api/gallery.rb 75 def testdrive options = {} 76 request_str = "/gallery/appliances/#{id.to_i}/testdrive" 77 request_str = Util.add_options request_str, options 78 response = GenericRequest.new(self.class.studio_connection).post request_str 79 tree = XmlSimple.xml_in response, "ForceArray" => false 80 tree["testdrive"] 81 end
unpublish()
click to toggle source
Removes appliance from gallery
# File lib/studio_api/gallery.rb 41 def unpublish 42 request_str = "/gallery/appliances/#{id.to_i}/version/#{CGI.escape version.to_s}" 43 response = GenericRequest.new(studio_connection).delete request_str 44 end
versions()
click to toggle source
Gets all available versions of appliance in gallery
# File lib/studio_api/gallery.rb 47 def versions 48 request_str = "/gallery/appliances/#{id.to_i}/versions" 49 response = GenericRequest.new(self.class.studio_connection).get request_str 50 tree = XmlSimple.xml_in response, "ForceArray" => ["version"] 51 return tree["appliance"]["versions"]["version"] 52 end