aspose_cells_cloud 22.5 → 22.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,301 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2022 Aspose.Cells Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+
21
+ =end
22
+
23
+ require 'date'
24
+
25
+ module AsposeCellsCloud
26
+
27
+ class JsonSaveOptions
28
+ attr_accessor :enable_http_compression
29
+
30
+ attr_accessor :save_format
31
+
32
+ # Make the workbook empty after saving the file.
33
+ attr_accessor :clear_data
34
+
35
+ # The cached file folder is used to store some large data.
36
+ attr_accessor :cached_file_folder
37
+
38
+ # Indicates whether validate merged areas before saving the file. The default value is false.
39
+ attr_accessor :validate_merged_areas
40
+
41
+ attr_accessor :refresh_chart_cache
42
+
43
+ # If true and the directory does not exist, the directory will be automatically created before saving the file.
44
+ attr_accessor :create_directory
45
+
46
+ attr_accessor :sort_names
47
+
48
+ attr_accessor :export_area
49
+
50
+ attr_accessor :has_header_row
51
+
52
+ attr_accessor :export_as_string
53
+
54
+ attr_accessor :indent
55
+
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'enable_http_compression' => :'EnableHTTPCompression',
61
+ :'save_format' => :'SaveFormat',
62
+ :'clear_data' => :'ClearData',
63
+ :'cached_file_folder' => :'CachedFileFolder',
64
+ :'validate_merged_areas' => :'ValidateMergedAreas',
65
+ :'refresh_chart_cache' => :'RefreshChartCache',
66
+ :'create_directory' => :'CreateDirectory',
67
+ :'sort_names' => :'SortNames',
68
+ :'export_area' => :'ExportArea',
69
+ :'has_header_row' => :'HasHeaderRow',
70
+ :'export_as_string' => :'ExportAsString',
71
+ :'indent' => :'Indent'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'enable_http_compression' => :'BOOLEAN',
79
+ :'save_format' => :'String',
80
+ :'clear_data' => :'BOOLEAN',
81
+ :'cached_file_folder' => :'String',
82
+ :'validate_merged_areas' => :'BOOLEAN',
83
+ :'refresh_chart_cache' => :'BOOLEAN',
84
+ :'create_directory' => :'BOOLEAN',
85
+ :'sort_names' => :'BOOLEAN',
86
+ :'export_area' => :'CellArea',
87
+ :'has_header_row' => :'BOOLEAN',
88
+ :'export_as_string' => :'BOOLEAN',
89
+ :'indent' => :'String'
90
+ }
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ return unless attributes.is_a?(Hash)
97
+
98
+ # convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
100
+
101
+ if attributes.has_key?(:'EnableHTTPCompression')
102
+ self.enable_http_compression = attributes[:'EnableHTTPCompression']
103
+ end
104
+
105
+ if attributes.has_key?(:'SaveFormat')
106
+ self.save_format = attributes[:'SaveFormat']
107
+ end
108
+
109
+ if attributes.has_key?(:'ClearData')
110
+ self.clear_data = attributes[:'ClearData']
111
+ end
112
+
113
+ if attributes.has_key?(:'CachedFileFolder')
114
+ self.cached_file_folder = attributes[:'CachedFileFolder']
115
+ end
116
+
117
+ if attributes.has_key?(:'ValidateMergedAreas')
118
+ self.validate_merged_areas = attributes[:'ValidateMergedAreas']
119
+ end
120
+
121
+ if attributes.has_key?(:'RefreshChartCache')
122
+ self.refresh_chart_cache = attributes[:'RefreshChartCache']
123
+ end
124
+
125
+ if attributes.has_key?(:'CreateDirectory')
126
+ self.create_directory = attributes[:'CreateDirectory']
127
+ end
128
+
129
+ if attributes.has_key?(:'SortNames')
130
+ self.sort_names = attributes[:'SortNames']
131
+ end
132
+
133
+ if attributes.has_key?(:'ExportArea')
134
+ self.export_area = attributes[:'ExportArea']
135
+ end
136
+
137
+ if attributes.has_key?(:'HasHeaderRow')
138
+ self.has_header_row = attributes[:'HasHeaderRow']
139
+ end
140
+
141
+ if attributes.has_key?(:'ExportAsString')
142
+ self.export_as_string = attributes[:'ExportAsString']
143
+ end
144
+
145
+ if attributes.has_key?(:'Indent')
146
+ self.indent = attributes[:'Indent']
147
+ end
148
+
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properies with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = Array.new
155
+ return invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ return true
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ enable_http_compression == o.enable_http_compression &&
170
+ save_format == o.save_format &&
171
+ clear_data == o.clear_data &&
172
+ cached_file_folder == o.cached_file_folder &&
173
+ validate_merged_areas == o.validate_merged_areas &&
174
+ refresh_chart_cache == o.refresh_chart_cache &&
175
+ create_directory == o.create_directory &&
176
+ sort_names == o.sort_names &&
177
+ export_area == o.export_area &&
178
+ has_header_row == o.has_header_row &&
179
+ export_as_string == o.export_as_string &&
180
+ indent == o.indent
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Fixnum] Hash code
191
+ def hash
192
+ [enable_http_compression, save_format, clear_data, cached_file_folder, validate_merged_areas, refresh_chart_cache, create_directory, sort_names, export_area, has_header_row, export_as_string, indent].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.swagger_types.each_pair do |key, type|
201
+ if type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ DateTime.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :BOOLEAN
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ temp_model = AsposeCellsCloud.const_get(type).new
253
+ temp_model.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ next if value.nil?
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Outputs non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ # @param [Object] value Any valid value
284
+ # @return [Hash] Returns the value in the form of hash
285
+ def _to_hash(value)
286
+ if value.is_a?(Array)
287
+ value.compact.map{ |v| _to_hash(v) }
288
+ elsif value.is_a?(Hash)
289
+ {}.tap do |hash|
290
+ value.each { |k, v| hash[k] = _to_hash(v) }
291
+ end
292
+ elsif value.respond_to? :to_hash
293
+ value.to_hash
294
+ else
295
+ value
296
+ end
297
+ end
298
+
299
+ end
300
+
301
+ end
@@ -0,0 +1,265 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2022 Aspose.Cells Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+
21
+ =end
22
+
23
+ require 'date'
24
+
25
+ module AsposeCellsCloud
26
+
27
+ class PptxSaveOptions
28
+ attr_accessor :enable_http_compression
29
+
30
+ attr_accessor :save_format
31
+
32
+ # Make the workbook empty after saving the file.
33
+ attr_accessor :clear_data
34
+
35
+ # The cached file folder is used to store some large data.
36
+ attr_accessor :cached_file_folder
37
+
38
+ # Indicates whether validate merged areas before saving the file. The default value is false.
39
+ attr_accessor :validate_merged_areas
40
+
41
+ attr_accessor :refresh_chart_cache
42
+
43
+ # If true and the directory does not exist, the directory will be automatically created before saving the file.
44
+ attr_accessor :create_directory
45
+
46
+ attr_accessor :sort_names
47
+
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'enable_http_compression' => :'EnableHTTPCompression',
53
+ :'save_format' => :'SaveFormat',
54
+ :'clear_data' => :'ClearData',
55
+ :'cached_file_folder' => :'CachedFileFolder',
56
+ :'validate_merged_areas' => :'ValidateMergedAreas',
57
+ :'refresh_chart_cache' => :'RefreshChartCache',
58
+ :'create_directory' => :'CreateDirectory',
59
+ :'sort_names' => :'SortNames'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.swagger_types
65
+ {
66
+ :'enable_http_compression' => :'BOOLEAN',
67
+ :'save_format' => :'String',
68
+ :'clear_data' => :'BOOLEAN',
69
+ :'cached_file_folder' => :'String',
70
+ :'validate_merged_areas' => :'BOOLEAN',
71
+ :'refresh_chart_cache' => :'BOOLEAN',
72
+ :'create_directory' => :'BOOLEAN',
73
+ :'sort_names' => :'BOOLEAN'
74
+ }
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ return unless attributes.is_a?(Hash)
81
+
82
+ # convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
84
+
85
+ if attributes.has_key?(:'EnableHTTPCompression')
86
+ self.enable_http_compression = attributes[:'EnableHTTPCompression']
87
+ end
88
+
89
+ if attributes.has_key?(:'SaveFormat')
90
+ self.save_format = attributes[:'SaveFormat']
91
+ end
92
+
93
+ if attributes.has_key?(:'ClearData')
94
+ self.clear_data = attributes[:'ClearData']
95
+ end
96
+
97
+ if attributes.has_key?(:'CachedFileFolder')
98
+ self.cached_file_folder = attributes[:'CachedFileFolder']
99
+ end
100
+
101
+ if attributes.has_key?(:'ValidateMergedAreas')
102
+ self.validate_merged_areas = attributes[:'ValidateMergedAreas']
103
+ end
104
+
105
+ if attributes.has_key?(:'RefreshChartCache')
106
+ self.refresh_chart_cache = attributes[:'RefreshChartCache']
107
+ end
108
+
109
+ if attributes.has_key?(:'CreateDirectory')
110
+ self.create_directory = attributes[:'CreateDirectory']
111
+ end
112
+
113
+ if attributes.has_key?(:'SortNames')
114
+ self.sort_names = attributes[:'SortNames']
115
+ end
116
+
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properies with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ return invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ return true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ enable_http_compression == o.enable_http_compression &&
138
+ save_format == o.save_format &&
139
+ clear_data == o.clear_data &&
140
+ cached_file_folder == o.cached_file_folder &&
141
+ validate_merged_areas == o.validate_merged_areas &&
142
+ refresh_chart_cache == o.refresh_chart_cache &&
143
+ create_directory == o.create_directory &&
144
+ sort_names == o.sort_names
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Fixnum] Hash code
155
+ def hash
156
+ [enable_http_compression, save_format, clear_data, cached_file_folder, validate_merged_areas, refresh_chart_cache, create_directory, sort_names].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.swagger_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :BOOLEAN
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ temp_model = AsposeCellsCloud.const_get(type).new
217
+ temp_model.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ next if value.nil?
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map{ |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end