groupdocs 0.3.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGELOG.md +150 -0
  2. data/README.md +6 -58
  3. data/Rakefile +1 -1
  4. data/examples/README.md +13 -0
  5. data/examples/annotations/Gemfile +5 -0
  6. data/examples/annotations/app.rb +67 -0
  7. data/groupdocs.gemspec +3 -3
  8. data/lib/groupdocs.rb +11 -2
  9. data/lib/groupdocs/api/entity.rb +17 -1
  10. data/lib/groupdocs/api/helpers/path_helper.rb +10 -10
  11. data/lib/groupdocs/api/helpers/rest_helper.rb +7 -2
  12. data/lib/groupdocs/api/helpers/url_helper.rb +2 -4
  13. data/lib/groupdocs/api/request.rb +2 -4
  14. data/lib/groupdocs/datasource.rb +2 -2
  15. data/lib/groupdocs/datasource/field.rb +1 -1
  16. data/lib/groupdocs/document.rb +6 -18
  17. data/lib/groupdocs/document/annotation.rb +25 -2
  18. data/lib/groupdocs/document/annotation/reply.rb +6 -10
  19. data/lib/groupdocs/document/change.rb +1 -1
  20. data/lib/groupdocs/document/field.rb +1 -1
  21. data/lib/groupdocs/document/metadata.rb +1 -1
  22. data/lib/groupdocs/document/rectangle.rb +1 -1
  23. data/lib/groupdocs/document/view.rb +1 -1
  24. data/lib/groupdocs/job.rb +51 -8
  25. data/lib/groupdocs/questionnaire.rb +2 -2
  26. data/lib/groupdocs/questionnaire/execution.rb +1 -1
  27. data/lib/groupdocs/questionnaire/page.rb +1 -1
  28. data/lib/groupdocs/questionnaire/question.rb +1 -1
  29. data/lib/groupdocs/questionnaire/question/answer.rb +1 -1
  30. data/lib/groupdocs/signature.rb +134 -0
  31. data/lib/groupdocs/signature/contact.rb +141 -0
  32. data/lib/groupdocs/signature/envelope.rb +376 -0
  33. data/lib/groupdocs/signature/envelope/log.rb +22 -0
  34. data/lib/groupdocs/signature/field.rb +253 -0
  35. data/lib/groupdocs/signature/field/location.rb +72 -0
  36. data/lib/groupdocs/signature/form.rb +202 -0
  37. data/lib/groupdocs/signature/list.rb +93 -0
  38. data/lib/groupdocs/signature/recipient.rb +47 -0
  39. data/lib/groupdocs/signature/role.rb +84 -0
  40. data/lib/groupdocs/signature/shared.rb +6 -0
  41. data/lib/groupdocs/signature/shared/document_methods.rb +98 -0
  42. data/lib/groupdocs/signature/shared/entity_fields.rb +94 -0
  43. data/lib/groupdocs/signature/shared/entity_methods.rb +145 -0
  44. data/lib/groupdocs/signature/shared/field_methods.rb +282 -0
  45. data/lib/groupdocs/signature/shared/recipient_methods.rb +63 -0
  46. data/lib/groupdocs/signature/shared/resource_methods.rb +65 -0
  47. data/lib/groupdocs/signature/template.rb +104 -0
  48. data/lib/groupdocs/storage/file.rb +69 -62
  49. data/lib/groupdocs/storage/folder.rb +54 -88
  50. data/lib/groupdocs/storage/package.rb +1 -1
  51. data/lib/groupdocs/subscription.rb +113 -0
  52. data/lib/groupdocs/subscription/limit.rb +24 -0
  53. data/lib/groupdocs/user.rb +22 -2
  54. data/lib/groupdocs/version.rb +1 -1
  55. data/spec/groupdocs/api/entity_spec.rb +14 -0
  56. data/spec/groupdocs/api/helpers/path_helper_spec.rb +6 -19
  57. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +9 -0
  58. data/spec/groupdocs/api/request_spec.rb +2 -7
  59. data/spec/groupdocs/datasource_spec.rb +3 -7
  60. data/spec/groupdocs/document/annotation/reply_spec.rb +11 -20
  61. data/spec/groupdocs/document/annotation_spec.rb +35 -31
  62. data/spec/groupdocs/document/field_spec.rb +1 -4
  63. data/spec/groupdocs/document/rectangle_spec.rb +10 -22
  64. data/spec/groupdocs/document_spec.rb +7 -27
  65. data/spec/groupdocs/job_spec.rb +43 -0
  66. data/spec/groupdocs/questionnaire/question_spec.rb +2 -6
  67. data/spec/groupdocs/questionnaire_spec.rb +3 -7
  68. data/spec/groupdocs/signature/contact_spec.rb +129 -0
  69. data/spec/groupdocs/signature/envelope/log_spec.rb +23 -0
  70. data/spec/groupdocs/signature/envelope_spec.rb +296 -0
  71. data/spec/groupdocs/signature/field/location_spec.rb +73 -0
  72. data/spec/groupdocs/signature/field_spec.rb +264 -0
  73. data/spec/groupdocs/signature/form_spec.rb +174 -0
  74. data/spec/groupdocs/signature/list_spec.rb +92 -0
  75. data/spec/groupdocs/signature/recipient_spec.rb +37 -0
  76. data/spec/groupdocs/signature/role_spec.rb +100 -0
  77. data/spec/groupdocs/signature/template_spec.rb +82 -0
  78. data/spec/groupdocs/signature_spec.rb +117 -0
  79. data/spec/groupdocs/storage/file_spec.rb +76 -61
  80. data/spec/groupdocs/storage/folder_spec.rb +43 -90
  81. data/spec/groupdocs/storage/package_spec.rb +1 -2
  82. data/spec/groupdocs/subscription/limit_spec.rb +24 -0
  83. data/spec/groupdocs/subscription_spec.rb +85 -0
  84. data/spec/groupdocs/user_spec.rb +27 -18
  85. data/spec/groupdocs_spec.rb +11 -0
  86. data/spec/spec_helper.rb +10 -1
  87. data/spec/support/files/envelope.zip +0 -0
  88. data/spec/support/json/annotation_access_set.json +11 -0
  89. data/spec/support/json/contact_add.json +12 -0
  90. data/spec/support/json/contacts_get.json +19 -0
  91. data/spec/support/json/contacts_import.json +8 -0
  92. data/spec/support/json/envelope_get.json +46 -0
  93. data/spec/support/json/envelope_logs.json +16 -0
  94. data/spec/support/json/envelopes_all.json +48 -0
  95. data/spec/support/json/envelopes_resources.json +31 -0
  96. data/spec/support/json/form_get.json +21 -0
  97. data/spec/support/json/forms_all.json +23 -0
  98. data/spec/support/json/job_get.json +30 -0
  99. data/spec/support/json/list_add.json +12 -0
  100. data/spec/support/json/lists_get.json +19 -0
  101. data/spec/support/json/signature_create.json +12 -0
  102. data/spec/support/json/signature_field_add.json +25 -0
  103. data/spec/support/json/signature_fields_get.json +27 -0
  104. data/spec/support/json/signature_roles_get.json +17 -0
  105. data/spec/support/json/signatures_get.json +19 -0
  106. data/spec/support/json/subscription_plan_get.json +9 -0
  107. data/spec/support/json/subscription_plans_get.json +17 -0
  108. data/spec/support/json/template_get.json +35 -0
  109. data/spec/support/json/template_get_documents.json +15 -0
  110. data/spec/support/json/template_get_recipients.json +20 -0
  111. data/spec/support/json/templates_all.json +37 -0
  112. data/spec/support/json/user_users_get.json +27 -0
  113. data/spec/support/shared_examples/signature/shared/document_methods.rb +68 -0
  114. data/spec/support/shared_examples/signature/shared/entity_fields.rb +89 -0
  115. data/spec/support/shared_examples/signature/shared/entity_methods.rb +116 -0
  116. data/spec/support/shared_examples/signature/shared/field_methods.rb +188 -0
  117. data/spec/support/shared_examples/signature/shared/recipient_methods.rb +42 -0
  118. data/spec/support/shared_examples/signature/shared/resource_methods.rb +46 -0
  119. metadata +139 -29
  120. data/lib/groupdocs/extensions.rb +0 -1
  121. data/lib/groupdocs/extensions/lookup.rb +0 -52
  122. data/spec/support/shared_examples/extensions/lookup.rb +0 -57
@@ -1,63 +1,73 @@
1
1
  module GroupDocs
2
2
  module Storage
3
- class File < GroupDocs::Api::Entity
3
+ class File < Api::Entity
4
4
 
5
- extend Extensions::Lookup
6
5
  include Api::Helpers::AccessMode
6
+ include Api::Helpers::Path
7
7
 
8
8
  DOCUMENT_TYPES = %w(Undefined Cells Words Slides Pdf Html Image)
9
9
 
10
10
  #
11
11
  # Uploads file to API server.
12
12
  #
13
- # @example
14
- # GroupDocs::Storage::File.upload!('resume.pdf', '/folder/cv.pdf', description: 'My resume')
13
+ # @example Upload file to root directory
14
+ # GroupDocs::Storage::File.upload!('resume.pdf')
15
+ #
16
+ # @example Upload file to specific directory
17
+ # GroupDocs::Storage::File.upload!('resume.pdf', path: 'folder1')
18
+ #
19
+ # @example Upload and rename file
20
+ # GroupDocs::Storage::File.upload!('resume.pdf', name: 'cv.pdf')
21
+ #
22
+ # @example Upload file with description
23
+ # GroupDocs::Storage::File.upload!('resume.pdf', description: 'Resume')
15
24
  #
16
25
  # @param [String] filepath Path to file to be uploaded
17
- # @param [String] upload_path Full path to directory to upload file to starting with "/".
18
- # You can also add filename and then uploaded file will use it.
26
+ # @param [Hash] options
27
+ # @option options [String] path Folder path to upload to
28
+ # @option options [String] name Name of file to be renamed
29
+ # @option options [String] description File description
19
30
  # @param [Hash] access Access credentials
20
31
  # @option access [String] :client_id
21
32
  # @option access [String] :private_key
22
33
  # @return [GroupDocs::Storage::File]
23
34
  #
24
- # @raise [ArgumentError] If path does not start with /
25
- #
26
- def self.upload!(filepath, upload_path = '/', access = {})
27
- Api::Helpers::Path.verify_starts_with_root(upload_path)
28
- Api::Helpers::Path.append_file_name(upload_path, filepath)
35
+ def self.upload!(filepath, options = {}, access = {})
36
+ options[:path] ||= ''
37
+ options[:name] ||= Object::File.basename(filepath)
38
+ path = prepare_path("#{options[:path]}/#{options[:name]}")
29
39
 
30
- json = Api::Request.new do |request|
40
+ api = Api::Request.new do |request|
31
41
  request[:access] = access
32
42
  request[:method] = :POST
33
- request[:path] = "/storage/{{client_id}}/folders#{upload_path}"
43
+ request[:path] = "/storage/{{client_id}}/folders/#{path}"
34
44
  request[:request_body] = Object::File.new(filepath, 'rb')
35
- end.execute!
45
+ end
46
+ api.add_params(description: options[:description]) if options[:description]
47
+ json = api.execute!
36
48
 
37
49
  Storage::File.new(json)
38
50
  end
39
51
 
40
52
  #
41
- # Returns an array of all files on server starting with given path.
53
+ # Uploads web page as file.
42
54
  #
43
- # @param [String] path Starting path to look for files
55
+ # @param [String] url
44
56
  # @param [Hash] access Access credentials
45
57
  # @option access [String] :client_id
46
58
  # @option access [String] :private_key
47
- # @return [Array<GroupDocs::Storage::File>]
48
- #
49
- def self.all!(path = '/', access = {})
50
- files = Array.new
51
- folder = GroupDocs::Storage::Folder.new(path: path)
52
- folder.list!({}, access).each do |entity|
53
- if entity.is_a?(GroupDocs::Storage::Folder)
54
- files += all!("#{path}/#{entity.name}", access)
55
- else
56
- files << entity
57
- end
59
+ # @return [GroupDocs::Storage::File]
60
+ #
61
+ def self.upload_web!(url, access = {})
62
+ api = Api::Request.new do |request|
63
+ request[:access] = access
64
+ request[:method] = :POST
65
+ request[:path] = '/storage/{{client_id}}/urls'
58
66
  end
67
+ api.add_params(url: url)
68
+ json = api.execute!
59
69
 
60
- files
70
+ Storage::File.new(json)
61
71
  end
62
72
 
63
73
  # @attr [Integer] id
@@ -152,26 +162,6 @@ module GroupDocs
152
162
  Time.at(@modified_on / 1000)
153
163
  end
154
164
 
155
- #
156
- # Uploads file to server.
157
- #
158
- # Note that it doesn't update self and instead returns new instance.
159
- #
160
- # @example
161
- # file = GroupDocs::Storage::File.new(name: 'document_one.doc', path: File.dirname(__FILE__))
162
- # file = file.upload!
163
- #
164
- # @param [String] upload_path Full path to directory to upload file to starting with "/".
165
- # You can also add filename and then uploaded file will use it.
166
- # @param [Hash] access Access credentials
167
- # @option access [String] :client_id
168
- # @option access [String] :private_key
169
- # @return [GroupDocs::Storage::File]
170
- #
171
- def upload!(upload_path = '/', access = {})
172
- self.class.upload!("#{path}/#{name}", upload_path, access)
173
- end
174
-
175
165
  #
176
166
  # Downloads file to given path.
177
167
  #
@@ -199,22 +189,23 @@ module GroupDocs
199
189
  #
200
190
  # Moves file to given path.
201
191
  #
202
- # @param [String] path Full path to directory to move file to starting with "/".
203
- # You can also add filename and then moved file will use it.
192
+ # @param [String] path
193
+ # @param [Hash] options
194
+ # @option options [String] name
204
195
  # @param [Hash] access Access credentials
205
196
  # @option access [String] :client_id
206
197
  # @option access [String] :private_key
207
198
  # @return [GroupDocs::Storage::File] Moved to file
208
199
  #
209
- def move!(path, access = {})
210
- Api::Helpers::Path.verify_starts_with_root(path)
211
- Api::Helpers::Path.append_file_name(path, name)
200
+ def move!(path, options = {}, access = {})
201
+ options[:name] ||= name
202
+ path = prepare_path("#{path}/#{options[:name]}")
212
203
 
213
204
  json = Api::Request.new do |request|
214
205
  request[:access] = access
215
206
  request[:method] = :PUT
216
207
  request[:headers] = { :'Groupdocs-Move' => id }
217
- request[:path] = "/storage/{{client_id}}/files#{path}"
208
+ request[:path] = "/storage/{{client_id}}/files/#{path}"
218
209
  end.execute!
219
210
 
220
211
  Storage::File.new(json[:dst_file])
@@ -230,28 +221,29 @@ module GroupDocs
230
221
  # @return [GroupDocs::Storage::File] Renamed file
231
222
  #
232
223
  def rename!(name, access = {})
233
- move!("#{path}#{name}", access)
224
+ move!(path, { name: name }, access)
234
225
  end
235
226
 
236
227
  #
237
228
  # Moves file to given path.
238
229
  #
239
- # @param [String] path Full path to directory to copy file to starting with "/".
240
- # You can also add filename and then copied file will use it.
230
+ # @param [String] path
231
+ # @param [Hash] options
232
+ # @option options [String] name
241
233
  # @param [Hash] access Access credentials
242
234
  # @option access [String] :client_id
243
235
  # @option access [String] :private_key
244
236
  # @return [GroupDocs::Storage::File] Copied to file
245
237
  #
246
- def copy!(path, access = {})
247
- Api::Helpers::Path.verify_starts_with_root(path)
248
- Api::Helpers::Path.append_file_name(path, name)
238
+ def copy!(path, options = {}, access = {})
239
+ options[:name] ||= name
240
+ path = prepare_path("#{path}/#{options[:name]}")
249
241
 
250
242
  json = Api::Request.new do |request|
251
243
  request[:access] = access
252
244
  request[:method] = :PUT
253
245
  request[:headers] = { :'Groupdocs-Copy' => id }
254
- request[:path] = "/storage/{{client_id}}/files#{path}"
246
+ request[:path] = "/storage/{{client_id}}/files/#{path}"
255
247
  end.execute!
256
248
 
257
249
  Storage::File.new(json[:dst_file])
@@ -272,7 +264,7 @@ module GroupDocs
272
264
  request[:path] = "/storage/{{client_id}}/files/#{id}/archive/zip"
273
265
  end.execute!
274
266
 
275
- # HACK add filename for further file operations
267
+ # add filename for further file operations
276
268
  json[:name] = "#{name}.zip"
277
269
  Storage::File.new(json)
278
270
  end
@@ -292,6 +284,21 @@ module GroupDocs
292
284
  end.execute!
293
285
  end
294
286
 
287
+ #
288
+ # Moves file to trash on server.
289
+ #
290
+ # @param [Hash] access Access credentials
291
+ # @option access [String] :client_id
292
+ # @option access [String] :private_key
293
+ #
294
+ def move_to_trash!(access = {})
295
+ Api::Request.new do |request|
296
+ request[:access] = access
297
+ request[:method] = :PUT
298
+ request[:path] = "/storage/{{client_id}}/trash/#{path}/#{name}"
299
+ end.execute!
300
+ end
301
+
295
302
  #
296
303
  # Converts file to GroupDocs::Document.
297
304
  #
@@ -1,9 +1,9 @@
1
1
  module GroupDocs
2
2
  module Storage
3
- class Folder < GroupDocs::Api::Entity
3
+ class Folder < Api::Entity
4
4
 
5
- extend Extensions::Lookup
6
5
  include Api::Helpers::AccessMode
6
+ include Api::Helpers::Path
7
7
 
8
8
  #
9
9
  # Creates folder on server.
@@ -15,39 +15,17 @@ module GroupDocs
15
15
  # @return [GroupDocs::Storage::Folder] Created folder
16
16
  #
17
17
  def self.create!(path, access = {})
18
- Api::Helpers::Path.verify_starts_with_root(path)
18
+ path = prepare_path(path)
19
19
 
20
20
  json = Api::Request.new do |request|
21
21
  request[:access] = access
22
22
  request[:method] = :POST
23
- request[:path] = "/storage/{{client_id}}/paths#{path}"
23
+ request[:path] = "/storage/{{client_id}}/paths/#{path}"
24
24
  end.execute!
25
25
 
26
26
  Storage::Folder.new(json)
27
27
  end
28
28
 
29
- #
30
- # Returns an array of all folders on server starting with given path.
31
- #
32
- # @param [String] path Starting path to look for folders
33
- # @param [Hash] access Access credentials
34
- # @option access [String] :client_id
35
- # @option access [String] :private_key
36
- # @return [Array<GroupDocs::Storage::Folder>]
37
- #
38
- def self.all!(path = '/', access = {})
39
- folders = Array.new
40
- folder = GroupDocs::Storage::Folder.new(path: path)
41
- folder.list!({}, access).each do |entity|
42
- if entity.is_a?(GroupDocs::Storage::Folder)
43
- folders << entity
44
- folders += all!("#{path}/#{entity.name}", access)
45
- end
46
- end
47
-
48
- folders
49
- end
50
-
51
29
  #
52
30
  # Returns a list of all directories and files in the path.
53
31
  #
@@ -62,8 +40,8 @@ module GroupDocs
62
40
  # @option access [String] :private_key
63
41
  # @return [Array<GroupDocs::Storage::Folder, GroupDocs::Storage::File>]
64
42
  #
65
- def self.list!(path = '/', options = {}, access = {})
66
- Api::Helpers::Path.verify_starts_with_root(path)
43
+ def self.list!(path = '', options = {}, access = {})
44
+ path = prepare_path(path)
67
45
  new(path: path).list!(options, access)
68
46
  end
69
47
 
@@ -120,98 +98,86 @@ module GroupDocs
120
98
  end
121
99
 
122
100
  #
123
- # Moves folder contents to given path.
101
+ # Returns an array of files and folders.
124
102
  #
125
- # @param [String] destination_path Destination to move contents to
103
+ # @param [Hash] options Hash of options
104
+ # @option options [Integer] :page Page to start with
105
+ # @option options [Integer] :count How many items to list
106
+ # @option options [String] :order_by Field name to sort by
107
+ # @option options [Boolean] :order_asc Set to true to return in ascending order
126
108
  # @param [Hash] access Access credentials
127
109
  # @option access [String] :client_id
128
110
  # @option access [String] :private_key
129
- # @return [String] Moved to folder path
111
+ # @return [Array<GroupDocs::Storage::Folder, GroupDocs::Storage::File>]
130
112
  #
131
- def move!(destination_path, access = {})
132
- Api::Helpers::Path.verify_starts_with_root(destination_path)
133
- destination_path = "#{destination_path}/#{name}"
113
+ def list!(options = {}, access = {})
114
+ options[:order_by].capitalize! if options[:order_by]
115
+ full_path = prepare_path("#{path}/#{name}")
134
116
 
135
- Api::Request.new do |request|
117
+ api = Api::Request.new do |request|
136
118
  request[:access] = access
137
- request[:method] = :PUT
138
- request[:headers] = { :'Groupdocs-Move' => path }
139
- request[:path] = "/storage/{{client_id}}/folders#{destination_path}"
140
- end.execute!
119
+ request[:method] = :GET
120
+ request[:path] = "/storage/{{client_id}}/folders/#{full_path}"
121
+ end
122
+ api.add_params(options)
123
+ json = api.execute!
141
124
 
142
- destination_path
143
- end
125
+ folders = json[:folders].map do |folder|
126
+ folder.merge!(path: full_path)
127
+ Storage::Folder.new(folder)
128
+ end
129
+ files = json[:files].map do |file|
130
+ file.merge!(path: full_path)
131
+ Storage::File.new(file)
132
+ end
144
133
 
145
- #
146
- # Renames folder to new one.
147
- #
148
- # @param [String] name New name
149
- # @param [Hash] access Access credentials
150
- # @option access [String] :client_id
151
- # @option access [String] :private_key
152
- # @return [String] New name
153
- #
154
- def rename!(name, access = {})
155
- move!("/#{name}", access).sub(/^\//, '')
134
+ folders + files
156
135
  end
157
136
 
158
137
  #
159
- # Copies folder contents to given path.
138
+ # Moves folder contents to given path.
160
139
  #
161
- # @param [String] destination_path Destination to copy contents to
140
+ # @param [String] destination Destination to move contents to
162
141
  # @param [Hash] access Access credentials
163
142
  # @option access [String] :client_id
164
143
  # @option access [String] :private_key
165
- # @return [String] Copied to folder path
144
+ # @return [String] Moved to folder path
166
145
  #
167
- def copy!(destination_path, access = {})
168
- Api::Helpers::Path.verify_starts_with_root(destination_path)
169
- destination_path = "#{destination_path}/#{name}"
146
+ def move!(destination, access = {})
147
+ src_path = prepare_path(path)
148
+ dst_path = prepare_path("#{destination}/#{name}")
170
149
 
171
150
  Api::Request.new do |request|
172
151
  request[:access] = access
173
152
  request[:method] = :PUT
174
- request[:headers] = { :'Groupdocs-Copy' => path }
175
- request[:path] = "/storage/{{client_id}}/folders#{destination_path}"
153
+ request[:headers] = { :'Groupdocs-Move' => src_path }
154
+ request[:path] = "/storage/{{client_id}}/folders/#{dst_path}"
176
155
  end.execute!
177
156
 
178
- destination_path
157
+ dst_path
179
158
  end
180
159
 
181
160
  #
182
- # Returns an array of files and folders.
161
+ # Copies folder contents to given path.
183
162
  #
184
- # @param [Hash] options Hash of options
185
- # @option options [Integer] :page Page to start with
186
- # @option options [Integer] :count How many items to list
187
- # @option options [String] :order_by Field name to sort by
188
- # @option options [Boolean] :order_asc Set to true to return in ascending order
163
+ # @param [String] destination_path Destination to copy contents to
189
164
  # @param [Hash] access Access credentials
190
165
  # @option access [String] :client_id
191
166
  # @option access [String] :private_key
192
- # @return [Array<GroupDocs::Storage::Folder, GroupDocs::Storage::File>]
167
+ # @return [String] Copied to folder path
193
168
  #
194
- def list!(options = {}, access = {})
195
- options[:order_by].capitalize! if options[:order_by]
169
+ def copy!(destination, access = {})
170
+ src_path = prepare_path(path)
171
+ dst_path = prepare_path("#{destination}/#{name}")
196
172
 
197
- api = Api::Request.new do |request|
173
+ Api::Request.new do |request|
198
174
  request[:access] = access
199
- request[:method] = :GET
200
- request[:path] = "/storage/{{client_id}}/folders#{path}/#{name}"
201
- end
202
- api.add_params(options)
203
- json = api.execute!
204
-
205
- folders = json[:folders].map do |folder|
206
- folder.merge!(path: path)
207
- Storage::Folder.new(folder)
208
- end
209
- files = json[:files].map do |file|
210
- file.merge!(path: path)
211
- Storage::File.new(file)
212
- end
175
+ request[:method] = :PUT
176
+ request[:headers] = { :'Groupdocs-Copy' => src_path }
177
+ request[:path] = "/storage/{{client_id}}/folders/#{dst_path}"
178
+ end.execute!
213
179
 
214
- folders + files
180
+ dst_path
215
181
  end
216
182
 
217
183
  #
@@ -229,7 +195,7 @@ module GroupDocs
229
195
  # @return [GroupDocs::Storage::Folder] Created folder
230
196
  #
231
197
  def create!(access = {})
232
- self.class.create!("/#{name}", access)
198
+ self.class.create! prepare_path("#{path}/#{name}"), access
233
199
  end
234
200
 
235
201
  #
@@ -243,7 +209,7 @@ module GroupDocs
243
209
  Api::Request.new do |request|
244
210
  request[:access] = access
245
211
  request[:method] = :DELETE
246
- request[:path] = "/storage/{{client_id}}/folders/#{path}/#{name}"
212
+ request[:path] = "/storage/{{client_id}}/folders/#{prepare_path("#{path}/#{name}")}"
247
213
  end.execute!
248
214
  end
249
215
 
@@ -1,6 +1,6 @@
1
1
  module GroupDocs
2
2
  module Storage
3
- class Package < GroupDocs::Api::Entity
3
+ class Package < Api::Entity
4
4
 
5
5
  # @attr [String] name Package name
6
6
  attr_accessor :name