aspose_storage_cloud 1.0.1 → 18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,220 @@
1
+ module AsposeStorageCloud
2
+ #
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ # <copyright company="Aspose Pty Ltd" file="FileExist.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 FileExist
31
+ attr_accessor :is_exist
32
+
33
+ attr_accessor :is_folder
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'is_exist' => :'IsExist',
40
+ :'is_folder' => :'IsFolder'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'is_exist' => :'BOOLEAN',
48
+ :'is_folder' => :'BOOLEAN'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
59
+
60
+ if attributes.has_key?(:'IsExist')
61
+ self.is_exist = attributes[:'IsExist']
62
+ end
63
+
64
+ if attributes.has_key?(:'IsFolder')
65
+ self.is_folder = attributes[:'IsFolder']
66
+ end
67
+
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properies with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @is_exist.nil?
75
+ invalid_properties.push("invalid value for 'is_exist', is_exist cannot be nil.")
76
+ end
77
+
78
+ if @is_folder.nil?
79
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
80
+ end
81
+
82
+ return invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @is_exist.nil?
89
+ return false if @is_folder.nil?
90
+ return true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ is_exist == o.is_exist &&
99
+ is_folder == o.is_folder
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Fixnum] Hash code
110
+ def hash
111
+ [is_exist, is_folder].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
142
+ Time.strptime(value, format).utc.to_datetime
143
+ when :Date
144
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
145
+ Time.strptime(value, format).utc.to_datetime.to_date
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = AsposeStorageCloud.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,224 @@
1
+ module AsposeStorageCloud
2
+ #
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ # <copyright company="Aspose Pty Ltd" file="FileExistResponse.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 FileExistResponse
31
+ attr_accessor :code
32
+
33
+ attr_accessor :status
34
+
35
+ attr_accessor :file_exist
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_exist' => :'FileExist'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'code' => :'Integer',
51
+ :'status' => :'String',
52
+ :'file_exist' => :'FileExist'
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?(:'FileExist')
73
+ self.file_exist = attributes[:'FileExist']
74
+ end
75
+
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properies with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @code.nil?
83
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
84
+ end
85
+
86
+ return invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if @code.nil?
93
+ return true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ code == o.code &&
102
+ status == o.status &&
103
+ file_exist == o.file_exist
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [code, status, file_exist].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
146
+ Time.strptime(value, format).utc.to_datetime
147
+ when :Date
148
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
149
+ Time.strptime(value, format).utc.to_datetime.to_date
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :BOOLEAN
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ temp_model = AsposeStorageCloud.const_get(type).new
178
+ temp_model.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,266 @@
1
+ module AsposeStorageCloud
2
+ #
3
+ # --------------------------------------------------------------------------------------------------------------------
4
+ # <copyright company="Aspose Pty Ltd" file="FileResponse.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 FileResponse
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
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'name' => :'Name',
48
+ :'is_folder' => :'IsFolder',
49
+ :'modified_date' => :'ModifiedDate',
50
+ :'size' => :'Size',
51
+ :'path' => :'Path',
52
+ :'is_directory' => :'IsDirectory'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'name' => :'String',
60
+ :'is_folder' => :'BOOLEAN',
61
+ :'modified_date' => :'DateTime',
62
+ :'size' => :'Integer',
63
+ :'path' => :'String',
64
+ :'is_directory' => :'BOOLEAN'
65
+ }
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ return unless attributes.is_a?(Hash)
72
+
73
+ # convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
75
+
76
+ if attributes.has_key?(:'Name')
77
+ self.name = attributes[:'Name']
78
+ end
79
+
80
+ if attributes.has_key?(:'IsFolder')
81
+ self.is_folder = attributes[:'IsFolder']
82
+ end
83
+
84
+ if attributes.has_key?(:'ModifiedDate')
85
+ self.modified_date = attributes[:'ModifiedDate']
86
+ end
87
+
88
+ if attributes.has_key?(:'Size')
89
+ self.size = attributes[:'Size']
90
+ end
91
+
92
+ if attributes.has_key?(:'Path')
93
+ self.path = attributes[:'Path']
94
+ end
95
+
96
+ if attributes.has_key?(:'IsDirectory')
97
+ self.is_directory = attributes[:'IsDirectory']
98
+ end
99
+
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properies with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @is_folder.nil?
107
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
108
+ end
109
+
110
+ if @modified_date.nil?
111
+ invalid_properties.push("invalid value for 'modified_date', modified_date cannot be nil.")
112
+ end
113
+
114
+ if @size.nil?
115
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
116
+ end
117
+
118
+ if @is_directory.nil?
119
+ invalid_properties.push("invalid value for 'is_directory', is_directory cannot be nil.")
120
+ end
121
+
122
+ return invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ return false if @is_folder.nil?
129
+ return false if @modified_date.nil?
130
+ return false if @size.nil?
131
+ return false if @is_directory.nil?
132
+ return true
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ name == o.name &&
141
+ is_folder == o.is_folder &&
142
+ modified_date == o.modified_date &&
143
+ size == o.size &&
144
+ path == o.path &&
145
+ is_directory == o.is_directory
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Fixnum] Hash code
156
+ def hash
157
+ [name, is_folder, modified_date, size, path, is_directory].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.swagger_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
188
+ Time.strptime(value, format).utc.to_datetime
189
+ when :Date
190
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
191
+ Time.strptime(value, format).utc.to_datetime.to_date
192
+ when :String
193
+ value.to_s
194
+ when :Integer
195
+ value.to_i
196
+ when :Float
197
+ value.to_f
198
+ when :BOOLEAN
199
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
+ true
201
+ else
202
+ false
203
+ end
204
+ when :Object
205
+ # generic object (usually a Hash), return directly
206
+ value
207
+ when /\AArray<(?<inner_type>.+)>\z/
208
+ inner_type = Regexp.last_match[:inner_type]
209
+ value.map { |v| _deserialize(inner_type, v) }
210
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
211
+ k_type = Regexp.last_match[:k_type]
212
+ v_type = Regexp.last_match[:v_type]
213
+ {}.tap do |hash|
214
+ value.each do |k, v|
215
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
+ end
217
+ end
218
+ else # model
219
+ temp_model = AsposeStorageCloud.const_get(type).new
220
+ temp_model.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ next if value.nil?
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map{ |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+ end
266
+ end