aspose_storage_cloud 1.0.1 → 18.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Aspose/Storage/api/storage_api.rb +982 -0
  3. data/lib/Aspose/Storage/api_client.rb +409 -0
  4. data/lib/Aspose/Storage/api_error.rb +54 -0
  5. data/lib/Aspose/Storage/configuration.rb +203 -0
  6. data/lib/Aspose/Storage/models/aspose_response.rb +215 -0
  7. data/lib/Aspose/Storage/models/copy_file_response.rb +215 -0
  8. data/lib/Aspose/Storage/models/create_folder_response.rb +215 -0
  9. data/lib/Aspose/Storage/models/disc_usage.rb +220 -0
  10. data/lib/Aspose/Storage/models/disc_usage_response.rb +224 -0
  11. data/lib/Aspose/Storage/models/file_exist.rb +220 -0
  12. data/lib/Aspose/Storage/models/file_exist_response.rb +224 -0
  13. data/lib/Aspose/Storage/models/file_response.rb +266 -0
  14. data/lib/Aspose/Storage/models/file_version.rb +284 -0
  15. data/lib/Aspose/Storage/models/file_versions_response.rb +226 -0
  16. data/lib/Aspose/Storage/models/files_response.rb +226 -0
  17. data/lib/Aspose/Storage/models/move_file_response.rb +215 -0
  18. data/lib/Aspose/Storage/models/move_folder_response.rb +215 -0
  19. data/lib/Aspose/Storage/models/remove_file_response.rb +215 -0
  20. data/lib/Aspose/Storage/models/remove_folder_response.rb +215 -0
  21. data/lib/Aspose/Storage/models/requests/delete_file_request.rb +57 -0
  22. data/lib/Aspose/Storage/models/requests/delete_folder_request.rb +57 -0
  23. data/lib/Aspose/Storage/models/requests/get_disc_usage_request.rb +47 -0
  24. data/lib/Aspose/Storage/models/requests/get_download_request.rb +57 -0
  25. data/lib/Aspose/Storage/models/requests/get_is_exist_request.rb +57 -0
  26. data/lib/Aspose/Storage/models/requests/get_is_storage_exist_request.rb +47 -0
  27. data/lib/Aspose/Storage/models/requests/get_list_file_versions_request.rb +52 -0
  28. data/lib/Aspose/Storage/models/requests/get_list_files_request.rb +52 -0
  29. data/lib/Aspose/Storage/models/requests/post_move_file_request.rb +67 -0
  30. data/lib/Aspose/Storage/models/requests/post_move_folder_request.rb +62 -0
  31. data/lib/Aspose/Storage/models/requests/put_copy_folder_request.rb +62 -0
  32. data/lib/Aspose/Storage/models/requests/put_copy_request.rb +67 -0
  33. data/lib/Aspose/Storage/models/requests/put_create_folder_request.rb +57 -0
  34. data/lib/Aspose/Storage/models/requests/put_create_request.rb +62 -0
  35. data/lib/Aspose/Storage/models/storage_exist_response.rb +224 -0
  36. data/lib/Aspose/Storage/models/upload_response.rb +215 -0
  37. data/lib/Aspose/Storage/version.rb +29 -0
  38. data/lib/aspose_storage_cloud.rb +71 -41
  39. metadata +62 -55
  40. data/.gitignore +0 -36
  41. data/LICENSE +0 -22
  42. data/README.md +0 -40
  43. data/aspose_storage_cloud.gemspec +0 -25
  44. data/lib/aspose_storage_cloud/api/storage_api.rb +0 -800
  45. data/lib/aspose_storage_cloud/api_client.rb +0 -333
  46. data/lib/aspose_storage_cloud/api_error.rb +0 -24
  47. data/lib/aspose_storage_cloud/aspose_app.rb +0 -20
  48. data/lib/aspose_storage_cloud/configuration.rb +0 -166
  49. data/lib/aspose_storage_cloud/models/base_object.rb +0 -88
  50. data/lib/aspose_storage_cloud/models/base_response.rb +0 -53
  51. data/lib/aspose_storage_cloud/models/disc_usage.rb +0 -45
  52. data/lib/aspose_storage_cloud/models/disc_usage_response.rb +0 -61
  53. data/lib/aspose_storage_cloud/models/file_exist.rb +0 -44
  54. data/lib/aspose_storage_cloud/models/file_exist_response.rb +0 -62
  55. data/lib/aspose_storage_cloud/models/file_response.rb +0 -69
  56. data/lib/aspose_storage_cloud/models/file_version.rb +0 -85
  57. data/lib/aspose_storage_cloud/models/file_versions_response.rb +0 -63
  58. data/lib/aspose_storage_cloud/models/folder_response.rb +0 -63
  59. data/lib/aspose_storage_cloud/models/storage_exist_response.rb +0 -61
  60. data/lib/aspose_storage_cloud/version.rb +0 -3
  61. data/test/data/SampleExecuteTemplate.doc +0 -0
  62. data/test/data/SampleExecuteTemplateData.txt +0 -49
  63. data/test/data/SampleWordDocument.docx +0 -0
  64. data/test/data/buzz.png +0 -0
  65. data/test/data/testfile.txt +0 -1
  66. data/test/storage_tests.rb +0 -134
@@ -0,0 +1,284 @@
1
+ module AsposeStorageCloud
2
+ #
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ # <copyright company="Aspose Pty Ltd" file="FileVersion.rb">
5
+ # Copyright (c) 2018 Aspose.Storage for Cloud
6
+ # </copyright>
7
+ # <summary>
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in all
16
+ # copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ # SOFTWARE.
25
+ # </summary>
26
+ # --------------------------------------------------------------------------------------------------------------------
27
+ #
28
+
29
+
30
+ class FileVersion
31
+ attr_accessor :name
32
+
33
+ attr_accessor :is_folder
34
+
35
+ attr_accessor :modified_date
36
+
37
+ attr_accessor :size
38
+
39
+ attr_accessor :path
40
+
41
+ attr_accessor :is_directory
42
+
43
+ attr_accessor :version_id
44
+
45
+ attr_accessor :is_latest
46
+
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'name' => :'Name',
52
+ :'is_folder' => :'IsFolder',
53
+ :'modified_date' => :'ModifiedDate',
54
+ :'size' => :'Size',
55
+ :'path' => :'Path',
56
+ :'is_directory' => :'IsDirectory',
57
+ :'version_id' => :'VersionId',
58
+ :'is_latest' => :'IsLatest'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ :'name' => :'String',
66
+ :'is_folder' => :'BOOLEAN',
67
+ :'modified_date' => :'DateTime',
68
+ :'size' => :'Integer',
69
+ :'path' => :'String',
70
+ :'is_directory' => :'BOOLEAN',
71
+ :'version_id' => :'String',
72
+ :'is_latest' => :'BOOLEAN'
73
+ }
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ return unless attributes.is_a?(Hash)
80
+
81
+ # convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
83
+
84
+ if attributes.has_key?(:'Name')
85
+ self.name = attributes[:'Name']
86
+ end
87
+
88
+ if attributes.has_key?(:'IsFolder')
89
+ self.is_folder = attributes[:'IsFolder']
90
+ end
91
+
92
+ if attributes.has_key?(:'ModifiedDate')
93
+ self.modified_date = attributes[:'ModifiedDate']
94
+ end
95
+
96
+ if attributes.has_key?(:'Size')
97
+ self.size = attributes[:'Size']
98
+ end
99
+
100
+ if attributes.has_key?(:'Path')
101
+ self.path = attributes[:'Path']
102
+ end
103
+
104
+ if attributes.has_key?(:'IsDirectory')
105
+ self.is_directory = attributes[:'IsDirectory']
106
+ end
107
+
108
+ if attributes.has_key?(:'VersionId')
109
+ self.version_id = attributes[:'VersionId']
110
+ end
111
+
112
+ if attributes.has_key?(:'IsLatest')
113
+ self.is_latest = attributes[:'IsLatest']
114
+ end
115
+
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properies with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ if @is_folder.nil?
123
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
124
+ end
125
+
126
+ if @modified_date.nil?
127
+ invalid_properties.push("invalid value for 'modified_date', modified_date cannot be nil.")
128
+ end
129
+
130
+ if @size.nil?
131
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
132
+ end
133
+
134
+ if @is_directory.nil?
135
+ invalid_properties.push("invalid value for 'is_directory', is_directory cannot be nil.")
136
+ end
137
+
138
+ return invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ return false if @is_folder.nil?
145
+ return false if @modified_date.nil?
146
+ return false if @size.nil?
147
+ return false if @is_directory.nil?
148
+ return true
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ name == o.name &&
157
+ is_folder == o.is_folder &&
158
+ modified_date == o.modified_date &&
159
+ size == o.size &&
160
+ path == o.path &&
161
+ is_directory == o.is_directory &&
162
+ version_id == o.version_id &&
163
+ is_latest == o.is_latest
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Fixnum] Hash code
174
+ def hash
175
+ [name, is_folder, modified_date, size, path, is_directory, version_id, is_latest].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ self.class.swagger_types.each_pair do |key, type|
184
+ if type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :DateTime
205
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
206
+ Time.strptime(value, format).utc.to_datetime
207
+ when :Date
208
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
209
+ Time.strptime(value, format).utc.to_datetime.to_date
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :BOOLEAN
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ temp_model = AsposeStorageCloud.const_get(type).new
238
+ temp_model.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ next if value.nil?
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map{ |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+ end
284
+ end
@@ -0,0 +1,226 @@
1
+ module AsposeStorageCloud
2
+ #
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ # <copyright company="Aspose Pty Ltd" file="FileVersionsResponse.rb">
5
+ # Copyright (c) 2018 Aspose.Storage for Cloud
6
+ # </copyright>
7
+ # <summary>
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in all
16
+ # copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ # SOFTWARE.
25
+ # </summary>
26
+ # --------------------------------------------------------------------------------------------------------------------
27
+ #
28
+
29
+
30
+ class FileVersionsResponse
31
+ attr_accessor :code
32
+
33
+ attr_accessor :status
34
+
35
+ attr_accessor :file_versions
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'code' => :'Code',
42
+ :'status' => :'Status',
43
+ :'file_versions' => :'FileVersions'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'code' => :'Integer',
51
+ :'status' => :'String',
52
+ :'file_versions' => :'Array<FileVersion>'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'Code')
65
+ self.code = attributes[:'Code']
66
+ end
67
+
68
+ if attributes.has_key?(:'Status')
69
+ self.status = attributes[:'Status']
70
+ end
71
+
72
+ if attributes.has_key?(:'FileVersions')
73
+ if (value = attributes[:'FileVersions']).is_a?(Array)
74
+ self.file_versions = value
75
+ end
76
+ end
77
+
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properies with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ if @code.nil?
85
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
86
+ end
87
+
88
+ return invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return false if @code.nil?
95
+ return true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ code == o.code &&
104
+ status == o.status &&
105
+ file_versions == o.file_versions
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [code, status, file_versions].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
148
+ Time.strptime(value, format).utc.to_datetime
149
+ when :Date
150
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
151
+ Time.strptime(value, format).utc.to_datetime.to_date
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :BOOLEAN
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ temp_model = AsposeStorageCloud.const_get(type).new
180
+ temp_model.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map{ |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+ end
226
+ end