class StudioApi::Rpm
Represents Additional rpms which can user upload to studio.
Allows uploading, downloading, listing (via find) and deleting
@example Delete own rpm
rpms = StudioApi::Rpm.find :all, :params => { :base_system => "SLE11" } my_pac = rpms.find {|r| r.filename =~ /my_pac/ } my_pac.delete
Public Class Methods
upload(content, base_system)
click to toggle source
Upload file to studio account (user repository) @param (String,File) content of rpm as String or as opened file, in which case name is used as name @param (to_s) base_system for which is rpm compiled @return [StudioApi::Rpm] uploaded RPM
# File lib/studio_api/rpm.rb 22 def self.upload content, base_system 23 response = GenericRequest.new(studio_connection).post "/rpms?base_system=#{CGI.escape base_system.to_s}", :file => content 24 if defined? ActiveModel #for rails3 we need persistent, otherwise delete method fail 25 self.new Hash.from_xml(response)["rpm"],true 26 else 27 self.new Hash.from_xml(response)["rpm"] 28 end 29 end
Public Instance Methods
content(&block)
click to toggle source
Downloads file to specified path. @return [String] content of rpm @yield [tempfile] Access the tempfile from the block parameter @yieldparam[tempfile Tempfile] Tempfile instance @yieldreturn [nil] Tempfile gets closed when the block returns
# File lib/studio_api/rpm.rb 36 def content &block 37 request = GenericRequest.new self.class.studio_connection 38 path = "/rpms/#{id.to_i}/data" 39 block_given? ? request.get_file(path, &block) : request.get(path) 40 end