Class: StudioApi::Rpm
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- StudioApi::Rpm
- Extended by:
- StudioResource
- Defined in:
- lib/studio_api/rpm.rb
Overview
Represents Additional rpms which can user upload to studio.
Allows uploading, downloading, listing (via find) and deleting
Class Method Summary collapse
-
.upload(content, base_system) ⇒ StudioApi::Rpm
Upload file to studio account (user repository).
Instance Method Summary collapse
-
#content {|tempfile| ... } ⇒ String
Downloads file to specified path.
Methods included from StudioResource
collection_path, element_path, extended, studio_connection, studio_connection=
Class Method Details
.upload(content, base_system) ⇒ StudioApi::Rpm
Upload file to studio account (user repository)
22 23 24 25 26 27 28 29 |
# File 'lib/studio_api/rpm.rb', line 22 def self.upload content, base_system response = GenericRequest.new(studio_connection).post "/rpms?base_system=#{CGI.escape base_system.to_s}", :file => content if defined? ActiveModel #for rails3 we need persistent, otherwise delete method fail self.new Hash.from_xml(response)["rpm"],true else self.new Hash.from_xml(response)["rpm"] end end |
Instance Method Details
#content {|tempfile| ... } ⇒ String
Downloads file to specified path. @yieldparam[tempfile Tempfile] Tempfile instance
36 37 38 39 40 |
# File 'lib/studio_api/rpm.rb', line 36 def content &block request = GenericRequest.new self.class.studio_connection path = "/rpms/#{id.to_i}/data" block_given? ? request.get_file(path, &block) : request.get(path) end |