Class: GroupDocs::Storage::Package
- Inherits:
-
Api::Entity
- Object
- Api::Entity
- GroupDocs::Storage::Package
- Includes:
- Api::Helpers::Path
- Defined in:
- lib/groupdocs/storage/package.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#add(object) ⇒ Object
(also: #<<)
Appends object to be packed.
-
#create!(access = {}) ⇒ String
Creates package on server.
Methods included from Api::Helpers::Path
Methods inherited from Api::Entity
#initialize, #inspect, #to_hash
Methods included from Api::Helpers::Accessor
Constructor Details
This class inherits a constructor from GroupDocs::Api::Entity
Instance Attribute Details
#name ⇒ Object
8 9 10 |
# File 'lib/groupdocs/storage/package.rb', line 8 def name @name end |
#objects ⇒ Object
10 11 12 |
# File 'lib/groupdocs/storage/package.rb', line 10 def objects @objects end |
Instance Method Details
#add(object) ⇒ Object Also known as: <<
Appends object to be packed.
17 18 19 20 |
# File 'lib/groupdocs/storage/package.rb', line 17 def add(object) @objects ||= Array.new @objects << object end |
#create!(access = {}) ⇒ String
Creates package on server.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/groupdocs/storage/package.rb', line 31 def create!(access = {}) paths = @objects.map do |object| prepare_path("#{object.path}/#{object.name}") end json = Api::Request.new do |request| request[:access] = access request[:method] = :POST request[:path] = "/storage/{{client_id}}/packages/#{name}.zip" request[:request_body] = paths end.execute! json[:url] end |