AsposeDiagramCloud 18.10 → 20.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/AsposeDiagramCloud.gemspec +46 -0
  3. data/Gemfile +7 -0
  4. data/README.md +74 -0
  5. data/Rakefile +8 -0
  6. data/git_push.sh +55 -0
  7. data/lib/AsposeDiagramCloud.rb +85 -0
  8. data/lib/AsposeDiagramCloud/api/diagram_api.rb +768 -0
  9. data/lib/AsposeDiagramCloud/api/o_auth_api.rb +93 -0
  10. data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
  11. data/lib/AsposeDiagramCloud/api_client.rb +391 -0
  12. data/lib/AsposeDiagramCloud/api_error.rb +38 -0
  13. data/lib/AsposeDiagramCloud/configuration.rb +209 -0
  14. data/lib/AsposeDiagramCloud/models/access_token_response.rb +251 -0
  15. data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
  16. data/lib/AsposeDiagramCloud/models/create_new_response.rb +188 -0
  17. data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
  18. data/lib/AsposeDiagramCloud/models/disc_usage.rb +209 -0
  19. data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
  20. data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
  21. data/lib/AsposeDiagramCloud/models/error.rb +219 -0
  22. data/lib/AsposeDiagramCloud/models/error_details.rb +204 -0
  23. data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
  24. data/lib/AsposeDiagramCloud/models/file_versions.rb +191 -0
  25. data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
  26. data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
  27. data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
  28. data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
  29. data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
  30. data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
  31. data/lib/AsposeDiagramCloud/models/object_exist.rb +209 -0
  32. data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
  33. data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
  34. data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
  35. data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
  36. data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
  37. data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
  38. data/lib/AsposeDiagramCloud/models/point_f.rb +221 -0
  39. data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
  40. data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
  41. data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
  42. data/lib/AsposeDiagramCloud/models/saa_spose_response.rb +179 -0
  43. data/lib/AsposeDiagramCloud/models/save_as_response.rb +208 -0
  44. data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
  45. data/lib/AsposeDiagramCloud/models/save_options_request.rb +206 -0
  46. data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
  47. data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
  48. data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
  49. data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
  50. data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
  51. data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
  52. data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
  53. data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
  54. data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
  55. data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
  56. data/lib/AsposeDiagramCloud/version.rb +15 -0
  57. data/spec/_spec.rb +308 -0
  58. data/spec/api/test_convert_spec.rb +308 -0
  59. data/spec/api/test_drawing_spec.rb +136 -0
  60. data/spec/api/test_page_spec.rb +92 -0
  61. data/spec/api_client_spec.rb +226 -0
  62. data/spec/configuration_spec.rb +42 -0
  63. data/spec/spec_helper.rb +120 -0
  64. data/testData/FileUpload.vdx +437 -0
  65. metadata +118 -49
@@ -0,0 +1,260 @@
1
+ =begin
2
+ #Aspose.Diagram Cloud API Reference
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 3.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AsposeDiagramCloud
16
+
17
+ class PdfEncryptionDetails
18
+ attr_accessor :permissions
19
+
20
+ attr_accessor :encryption_algorithm
21
+
22
+ attr_accessor :user_password
23
+
24
+ attr_accessor :owner_password
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'permissions' => :'Permissions',
52
+ :'encryption_algorithm' => :'EncryptionAlgorithm',
53
+ :'user_password' => :'UserPassword',
54
+ :'owner_password' => :'OwnerPassword'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.swagger_types
60
+ {
61
+ :'permissions' => :'String',
62
+ :'encryption_algorithm' => :'String',
63
+ :'user_password' => :'String',
64
+ :'owner_password' => :'String'
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?(:'Permissions')
77
+ self.permissions = attributes[:'Permissions']
78
+ end
79
+
80
+ if attributes.has_key?(:'EncryptionAlgorithm')
81
+ self.encryption_algorithm = attributes[:'EncryptionAlgorithm']
82
+ end
83
+
84
+ if attributes.has_key?(:'UserPassword')
85
+ self.user_password = attributes[:'UserPassword']
86
+ end
87
+
88
+ if attributes.has_key?(:'OwnerPassword')
89
+ self.owner_password = attributes[:'OwnerPassword']
90
+ end
91
+
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properies with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ return invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ permissions_validator = EnumAttributeValidator.new('String', ["DisallowAll", "Printing", "ModifyContents", "ContentCopy", "ModifyAnnotations", "FillIn", "ContentCopyForAccessibility", "DocumentAssembly", "HighResolutionPrinting", "AllowAll"])
105
+ return false unless permissions_validator.valid?(@permissions)
106
+ encryption_algorithm_validator = EnumAttributeValidator.new('String', ["RC4_40", "RC4_128"])
107
+ return false unless encryption_algorithm_validator.valid?(@encryption_algorithm)
108
+ return true
109
+ end
110
+
111
+ # Custom attribute writer method checking allowed values (enum).
112
+ # @param [Object] permissions Object to be assigned
113
+ def permissions=(permissions)
114
+ validator = EnumAttributeValidator.new('String', ["DisallowAll", "Printing", "ModifyContents", "ContentCopy", "ModifyAnnotations", "FillIn", "ContentCopyForAccessibility", "DocumentAssembly", "HighResolutionPrinting", "AllowAll"])
115
+ unless validator.valid?(permissions)
116
+ fail ArgumentError, "invalid value for 'permissions', must be one of #{validator.allowable_values}."
117
+ end
118
+ @permissions = permissions
119
+ end
120
+
121
+ # Custom attribute writer method checking allowed values (enum).
122
+ # @param [Object] encryption_algorithm Object to be assigned
123
+ def encryption_algorithm=(encryption_algorithm)
124
+ validator = EnumAttributeValidator.new('String', ["RC4_40", "RC4_128"])
125
+ unless validator.valid?(encryption_algorithm)
126
+ fail ArgumentError, "invalid value for 'encryption_algorithm', must be one of #{validator.allowable_values}."
127
+ end
128
+ @encryption_algorithm = encryption_algorithm
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ permissions == o.permissions &&
137
+ encryption_algorithm == o.encryption_algorithm &&
138
+ user_password == o.user_password &&
139
+ owner_password == o.owner_password
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Fixnum] Hash code
150
+ def hash
151
+ [permissions, encryption_algorithm, user_password, owner_password].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.swagger_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :BOOLEAN
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ temp_model = AsposeDiagramCloud.const_get(type).new
212
+ temp_model.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ next if value.nil?
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map{ |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end
@@ -0,0 +1,408 @@
1
+ =begin
2
+ #Aspose.Diagram Cloud API Reference
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 3.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AsposeDiagramCloud
16
+
17
+ class PdfSaveOptions
18
+ attr_accessor :save_format
19
+
20
+ attr_accessor :default_font
21
+
22
+ attr_accessor :area
23
+
24
+ attr_accessor :export_guide_shapes
25
+
26
+ attr_accessor :page_size
27
+
28
+ attr_accessor :is_export_comments
29
+
30
+ attr_accessor :horizontal_resolution
31
+
32
+ attr_accessor :vertical_resolution
33
+
34
+ attr_accessor :page_count
35
+
36
+ attr_accessor :jpeg_quality
37
+
38
+ attr_accessor :export_hidden_page
39
+
40
+ attr_accessor :page_index
41
+
42
+ attr_accessor :save_foreground_pages_only
43
+
44
+ attr_accessor :compliance
45
+
46
+ attr_accessor :encryption_details
47
+
48
+ attr_accessor :text_compression
49
+
50
+ attr_accessor :split_multi_pages
51
+
52
+ attr_accessor :digital_signature_details
53
+
54
+ class EnumAttributeValidator
55
+ attr_reader :datatype
56
+ attr_reader :allowable_values
57
+
58
+ def initialize(datatype, allowable_values)
59
+ @allowable_values = allowable_values.map do |value|
60
+ case datatype.to_s
61
+ when /Integer/i
62
+ value.to_i
63
+ when /Float/i
64
+ value.to_f
65
+ else
66
+ value
67
+ end
68
+ end
69
+ end
70
+
71
+ def valid?(value)
72
+ !value || allowable_values.include?(value)
73
+ end
74
+ end
75
+
76
+ # Attribute mapping from ruby-style variable name to JSON key.
77
+ def self.attribute_map
78
+ {
79
+ :'save_format' => :'SaveFormat',
80
+ :'default_font' => :'DefaultFont',
81
+ :'area' => :'Area',
82
+ :'export_guide_shapes' => :'ExportGuideShapes',
83
+ :'page_size' => :'PageSize',
84
+ :'is_export_comments' => :'IsExportComments',
85
+ :'horizontal_resolution' => :'HorizontalResolution',
86
+ :'vertical_resolution' => :'VerticalResolution',
87
+ :'page_count' => :'PageCount',
88
+ :'jpeg_quality' => :'JpegQuality',
89
+ :'export_hidden_page' => :'ExportHiddenPage',
90
+ :'page_index' => :'PageIndex',
91
+ :'save_foreground_pages_only' => :'SaveForegroundPagesOnly',
92
+ :'compliance' => :'Compliance',
93
+ :'encryption_details' => :'EncryptionDetails',
94
+ :'text_compression' => :'TextCompression',
95
+ :'split_multi_pages' => :'SplitMultiPages',
96
+ :'digital_signature_details' => :'DigitalSignatureDetails'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.swagger_types
102
+ {
103
+ :'save_format' => :'String',
104
+ :'default_font' => :'String',
105
+ :'area' => :'RectangleF',
106
+ :'export_guide_shapes' => :'BOOLEAN',
107
+ :'page_size' => :'PageSize',
108
+ :'is_export_comments' => :'BOOLEAN',
109
+ :'horizontal_resolution' => :'Integer',
110
+ :'vertical_resolution' => :'Integer',
111
+ :'page_count' => :'Integer',
112
+ :'jpeg_quality' => :'Integer',
113
+ :'export_hidden_page' => :'BOOLEAN',
114
+ :'page_index' => :'Integer',
115
+ :'save_foreground_pages_only' => :'BOOLEAN',
116
+ :'compliance' => :'String',
117
+ :'encryption_details' => :'PdfEncryptionDetails',
118
+ :'text_compression' => :'String',
119
+ :'split_multi_pages' => :'BOOLEAN',
120
+ :'digital_signature_details' => :'PdfDigitalSignatureDetails'
121
+ }
122
+ end
123
+
124
+ # Initializes the object
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ def initialize(attributes = {})
127
+ return unless attributes.is_a?(Hash)
128
+
129
+ # convert string to symbol for hash key
130
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
131
+
132
+ if attributes.has_key?(:'SaveFormat')
133
+ self.save_format = attributes[:'SaveFormat']
134
+ end
135
+
136
+ if attributes.has_key?(:'DefaultFont')
137
+ self.default_font = attributes[:'DefaultFont']
138
+ end
139
+
140
+ if attributes.has_key?(:'Area')
141
+ self.area = attributes[:'Area']
142
+ end
143
+
144
+ if attributes.has_key?(:'ExportGuideShapes')
145
+ self.export_guide_shapes = attributes[:'ExportGuideShapes']
146
+ end
147
+
148
+ if attributes.has_key?(:'PageSize')
149
+ self.page_size = attributes[:'PageSize']
150
+ end
151
+
152
+ if attributes.has_key?(:'IsExportComments')
153
+ self.is_export_comments = attributes[:'IsExportComments']
154
+ end
155
+
156
+ if attributes.has_key?(:'HorizontalResolution')
157
+ self.horizontal_resolution = attributes[:'HorizontalResolution']
158
+ end
159
+
160
+ if attributes.has_key?(:'VerticalResolution')
161
+ self.vertical_resolution = attributes[:'VerticalResolution']
162
+ end
163
+
164
+ if attributes.has_key?(:'PageCount')
165
+ self.page_count = attributes[:'PageCount']
166
+ end
167
+
168
+ if attributes.has_key?(:'JpegQuality')
169
+ self.jpeg_quality = attributes[:'JpegQuality']
170
+ end
171
+
172
+ if attributes.has_key?(:'ExportHiddenPage')
173
+ self.export_hidden_page = attributes[:'ExportHiddenPage']
174
+ end
175
+
176
+ if attributes.has_key?(:'PageIndex')
177
+ self.page_index = attributes[:'PageIndex']
178
+ end
179
+
180
+ if attributes.has_key?(:'SaveForegroundPagesOnly')
181
+ self.save_foreground_pages_only = attributes[:'SaveForegroundPagesOnly']
182
+ end
183
+
184
+ if attributes.has_key?(:'Compliance')
185
+ self.compliance = attributes[:'Compliance']
186
+ end
187
+
188
+ if attributes.has_key?(:'EncryptionDetails')
189
+ self.encryption_details = attributes[:'EncryptionDetails']
190
+ end
191
+
192
+ if attributes.has_key?(:'TextCompression')
193
+ self.text_compression = attributes[:'TextCompression']
194
+ end
195
+
196
+ if attributes.has_key?(:'SplitMultiPages')
197
+ self.split_multi_pages = attributes[:'SplitMultiPages']
198
+ end
199
+
200
+ if attributes.has_key?(:'DigitalSignatureDetails')
201
+ self.digital_signature_details = attributes[:'DigitalSignatureDetails']
202
+ end
203
+
204
+ end
205
+
206
+ # Show invalid properties with the reasons. Usually used together with valid?
207
+ # @return Array for valid properies with the reasons
208
+ def list_invalid_properties
209
+ invalid_properties = Array.new
210
+ if @save_format.nil?
211
+ invalid_properties.push("invalid value for 'save_format', save_format cannot be nil.")
212
+ end
213
+
214
+ if @area.nil?
215
+ invalid_properties.push("invalid value for 'area', area cannot be nil.")
216
+ end
217
+
218
+ return invalid_properties
219
+ end
220
+
221
+ # Check to see if the all the properties in the model are valid
222
+ # @return true if the model is valid
223
+ def valid?
224
+ return false if @save_format.nil?
225
+ save_format_validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
226
+ return false unless save_format_validator.valid?(@save_format)
227
+ return false if @area.nil?
228
+ compliance_validator = EnumAttributeValidator.new('String', ["Pdf15", "PdfA1a", "PdfA1b"])
229
+ return false unless compliance_validator.valid?(@compliance)
230
+ text_compression_validator = EnumAttributeValidator.new('String', ["None", "Flate"])
231
+ return false unless text_compression_validator.valid?(@text_compression)
232
+ return true
233
+ end
234
+
235
+ # Custom attribute writer method checking allowed values (enum).
236
+ # @param [Object] save_format Object to be assigned
237
+ def save_format=(save_format)
238
+ validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
239
+ unless validator.valid?(save_format)
240
+ fail ArgumentError, "invalid value for 'save_format', must be one of #{validator.allowable_values}."
241
+ end
242
+ @save_format = save_format
243
+ end
244
+
245
+ # Custom attribute writer method checking allowed values (enum).
246
+ # @param [Object] compliance Object to be assigned
247
+ def compliance=(compliance)
248
+ validator = EnumAttributeValidator.new('String', ["Pdf15", "PdfA1a", "PdfA1b"])
249
+ unless validator.valid?(compliance)
250
+ fail ArgumentError, "invalid value for 'compliance', must be one of #{validator.allowable_values}."
251
+ end
252
+ @compliance = compliance
253
+ end
254
+
255
+ # Custom attribute writer method checking allowed values (enum).
256
+ # @param [Object] text_compression Object to be assigned
257
+ def text_compression=(text_compression)
258
+ validator = EnumAttributeValidator.new('String', ["None", "Flate"])
259
+ unless validator.valid?(text_compression)
260
+ fail ArgumentError, "invalid value for 'text_compression', must be one of #{validator.allowable_values}."
261
+ end
262
+ @text_compression = text_compression
263
+ end
264
+
265
+ # Checks equality by comparing each attribute.
266
+ # @param [Object] Object to be compared
267
+ def ==(o)
268
+ return true if self.equal?(o)
269
+ self.class == o.class &&
270
+ save_format == o.save_format &&
271
+ default_font == o.default_font &&
272
+ area == o.area &&
273
+ export_guide_shapes == o.export_guide_shapes &&
274
+ page_size == o.page_size &&
275
+ is_export_comments == o.is_export_comments &&
276
+ horizontal_resolution == o.horizontal_resolution &&
277
+ vertical_resolution == o.vertical_resolution &&
278
+ page_count == o.page_count &&
279
+ jpeg_quality == o.jpeg_quality &&
280
+ export_hidden_page == o.export_hidden_page &&
281
+ page_index == o.page_index &&
282
+ save_foreground_pages_only == o.save_foreground_pages_only &&
283
+ compliance == o.compliance &&
284
+ encryption_details == o.encryption_details &&
285
+ text_compression == o.text_compression &&
286
+ split_multi_pages == o.split_multi_pages &&
287
+ digital_signature_details == o.digital_signature_details
288
+ end
289
+
290
+ # @see the `==` method
291
+ # @param [Object] Object to be compared
292
+ def eql?(o)
293
+ self == o
294
+ end
295
+
296
+ # Calculates hash code according to all attributes.
297
+ # @return [Fixnum] Hash code
298
+ def hash
299
+ [save_format, default_font, area, export_guide_shapes, page_size, is_export_comments, horizontal_resolution, vertical_resolution, page_count, jpeg_quality, export_hidden_page, page_index, save_foreground_pages_only, compliance, encryption_details, text_compression, split_multi_pages, digital_signature_details].hash
300
+ end
301
+
302
+ # Builds the object from hash
303
+ # @param [Hash] attributes Model attributes in the form of hash
304
+ # @return [Object] Returns the model itself
305
+ def build_from_hash(attributes)
306
+ return nil unless attributes.is_a?(Hash)
307
+ self.class.swagger_types.each_pair do |key, type|
308
+ if type =~ /\AArray<(.*)>/i
309
+ # check to ensure the input is an array given that the the attribute
310
+ # is documented as an array but the input is not
311
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
312
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
313
+ end
314
+ elsif !attributes[self.class.attribute_map[key]].nil?
315
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
316
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
317
+ end
318
+
319
+ self
320
+ end
321
+
322
+ # Deserializes the data based on type
323
+ # @param string type Data type
324
+ # @param string value Value to be deserialized
325
+ # @return [Object] Deserialized data
326
+ def _deserialize(type, value)
327
+ case type.to_sym
328
+ when :DateTime
329
+ DateTime.parse(value)
330
+ when :Date
331
+ Date.parse(value)
332
+ when :String
333
+ value.to_s
334
+ when :Integer
335
+ value.to_i
336
+ when :Float
337
+ value.to_f
338
+ when :BOOLEAN
339
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
340
+ true
341
+ else
342
+ false
343
+ end
344
+ when :Object
345
+ # generic object (usually a Hash), return directly
346
+ value
347
+ when /\AArray<(?<inner_type>.+)>\z/
348
+ inner_type = Regexp.last_match[:inner_type]
349
+ value.map { |v| _deserialize(inner_type, v) }
350
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
351
+ k_type = Regexp.last_match[:k_type]
352
+ v_type = Regexp.last_match[:v_type]
353
+ {}.tap do |hash|
354
+ value.each do |k, v|
355
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
356
+ end
357
+ end
358
+ else # model
359
+ temp_model = AsposeDiagramCloud.const_get(type).new
360
+ temp_model.build_from_hash(value)
361
+ end
362
+ end
363
+
364
+ # Returns the string representation of the object
365
+ # @return [String] String presentation of the object
366
+ def to_s
367
+ to_hash.to_s
368
+ end
369
+
370
+ # to_body is an alias to to_hash (backward compatibility)
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_body
373
+ to_hash
374
+ end
375
+
376
+ # Returns the object in the form of hash
377
+ # @return [Hash] Returns the object in the form of hash
378
+ def to_hash
379
+ hash = {}
380
+ self.class.attribute_map.each_pair do |attr, param|
381
+ value = self.send(attr)
382
+ next if value.nil?
383
+ hash[param] = _to_hash(value)
384
+ end
385
+ hash
386
+ end
387
+
388
+ # Outputs non-array value in the form of hash
389
+ # For object, use to_hash. Otherwise, just return the value
390
+ # @param [Object] value Any valid value
391
+ # @return [Hash] Returns the value in the form of hash
392
+ def _to_hash(value)
393
+ if value.is_a?(Array)
394
+ value.compact.map{ |v| _to_hash(v) }
395
+ elsif value.is_a?(Hash)
396
+ {}.tap do |hash|
397
+ value.each { |k, v| hash[k] = _to_hash(v) }
398
+ end
399
+ elsif value.respond_to? :to_hash
400
+ value.to_hash
401
+ else
402
+ value
403
+ end
404
+ end
405
+
406
+ end
407
+
408
+ end