groupdocs_viewer_cloud 18.7

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 (106) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_viewer_cloud.rb +104 -0
  3. data/lib/groupdocs_viewer_cloud/api/viewer_api.rb +5296 -0
  4. data/lib/groupdocs_viewer_cloud/api_client.rb +390 -0
  5. data/lib/groupdocs_viewer_cloud/api_error.rb +56 -0
  6. data/lib/groupdocs_viewer_cloud/configuration.rb +95 -0
  7. data/lib/groupdocs_viewer_cloud/models/attachment.rb +216 -0
  8. data/lib/groupdocs_viewer_cloud/models/attachment_collection.rb +228 -0
  9. data/lib/groupdocs_viewer_cloud/models/attachment_info.rb +226 -0
  10. data/lib/groupdocs_viewer_cloud/models/cad_options.rb +270 -0
  11. data/lib/groupdocs_viewer_cloud/models/cells_options.rb +296 -0
  12. data/lib/groupdocs_viewer_cloud/models/document_info.rb +282 -0
  13. data/lib/groupdocs_viewer_cloud/models/document_info_options.rb +348 -0
  14. data/lib/groupdocs_viewer_cloud/models/email_options.rb +228 -0
  15. data/lib/groupdocs_viewer_cloud/models/field_label.rb +216 -0
  16. data/lib/groupdocs_viewer_cloud/models/file_response.rb +196 -0
  17. data/lib/groupdocs_viewer_cloud/models/font_collection.rb +208 -0
  18. data/lib/groupdocs_viewer_cloud/models/font_family.rb +206 -0
  19. data/lib/groupdocs_viewer_cloud/models/format.rb +216 -0
  20. data/lib/groupdocs_viewer_cloud/models/format_collection.rb +208 -0
  21. data/lib/groupdocs_viewer_cloud/models/html_attachment_page_collection.rb +238 -0
  22. data/lib/groupdocs_viewer_cloud/models/html_options.rb +428 -0
  23. data/lib/groupdocs_viewer_cloud/models/html_page.rb +228 -0
  24. data/lib/groupdocs_viewer_cloud/models/html_page_collection.rb +228 -0
  25. data/lib/groupdocs_viewer_cloud/models/image_attachment_page_collection.rb +238 -0
  26. data/lib/groupdocs_viewer_cloud/models/image_options.rb +408 -0
  27. data/lib/groupdocs_viewer_cloud/models/image_page.rb +216 -0
  28. data/lib/groupdocs_viewer_cloud/models/image_page_collection.rb +238 -0
  29. data/lib/groupdocs_viewer_cloud/models/page_info.rb +268 -0
  30. data/lib/groupdocs_viewer_cloud/models/page_info_collection.rb +208 -0
  31. data/lib/groupdocs_viewer_cloud/models/pdf_file_info.rb +236 -0
  32. data/lib/groupdocs_viewer_cloud/models/pdf_file_options.rb +348 -0
  33. data/lib/groupdocs_viewer_cloud/models/pdf_options.rb +236 -0
  34. data/lib/groupdocs_viewer_cloud/models/project_options.rb +216 -0
  35. data/lib/groupdocs_viewer_cloud/models/render_options.rb +368 -0
  36. data/lib/groupdocs_viewer_cloud/models/render_options_base.rb +348 -0
  37. data/lib/groupdocs_viewer_cloud/models/reorder_options.rb +226 -0
  38. data/lib/groupdocs_viewer_cloud/models/requests/html_create_attachment_pages_cache_request.rb +65 -0
  39. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pages_cache_from_content_request.rb +65 -0
  40. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pages_cache_from_url_request.rb +65 -0
  41. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pages_cache_request.rb +61 -0
  42. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pdf_file_from_content_request.rb +65 -0
  43. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pdf_file_from_url_request.rb +65 -0
  44. data/lib/groupdocs_viewer_cloud/models/requests/html_create_pdf_file_request.rb +61 -0
  45. data/lib/groupdocs_viewer_cloud/models/requests/html_delete_attachment_pages_cache_request.rb +57 -0
  46. data/lib/groupdocs_viewer_cloud/models/requests/html_delete_pages_cache_request.rb +53 -0
  47. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_info_request.rb +65 -0
  48. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_info_with_options_request.rb +61 -0
  49. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_page_request.rb +109 -0
  50. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_page_resource_request.rb +65 -0
  51. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_pages_request.rb +113 -0
  52. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachment_request.rb +61 -0
  53. data/lib/groupdocs_viewer_cloud/models/requests/html_get_attachments_request.rb +57 -0
  54. data/lib/groupdocs_viewer_cloud/models/requests/html_get_document_info_from_content_request.rb +61 -0
  55. data/lib/groupdocs_viewer_cloud/models/requests/html_get_document_info_from_url_request.rb +69 -0
  56. data/lib/groupdocs_viewer_cloud/models/requests/html_get_document_info_from_url_with_options_request.rb +61 -0
  57. data/lib/groupdocs_viewer_cloud/models/requests/html_get_document_info_request.rb +65 -0
  58. data/lib/groupdocs_viewer_cloud/models/requests/html_get_document_info_with_options_request.rb +57 -0
  59. data/lib/groupdocs_viewer_cloud/models/requests/html_get_page_request.rb +101 -0
  60. data/lib/groupdocs_viewer_cloud/models/requests/html_get_page_resource_request.rb +61 -0
  61. data/lib/groupdocs_viewer_cloud/models/requests/html_get_pages_from_url_request.rb +109 -0
  62. data/lib/groupdocs_viewer_cloud/models/requests/html_get_pages_request.rb +105 -0
  63. data/lib/groupdocs_viewer_cloud/models/requests/html_get_pdf_file_from_url_request.rb +77 -0
  64. data/lib/groupdocs_viewer_cloud/models/requests/html_get_pdf_file_request.rb +73 -0
  65. data/lib/groupdocs_viewer_cloud/models/requests/html_get_zip_with_attachment_pages_request.rb +113 -0
  66. data/lib/groupdocs_viewer_cloud/models/requests/html_get_zip_with_pages_request.rb +105 -0
  67. data/lib/groupdocs_viewer_cloud/models/requests/html_transform_pages_request.rb +57 -0
  68. data/lib/groupdocs_viewer_cloud/models/requests/image_create_attachment_pages_cache_request.rb +65 -0
  69. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pages_cache_from_content_request.rb +65 -0
  70. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pages_cache_from_url_request.rb +65 -0
  71. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pages_cache_request.rb +61 -0
  72. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pdf_file_from_content_request.rb +65 -0
  73. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pdf_file_from_url_request.rb +65 -0
  74. data/lib/groupdocs_viewer_cloud/models/requests/image_create_pdf_file_request.rb +61 -0
  75. data/lib/groupdocs_viewer_cloud/models/requests/image_delete_attachment_pages_cache_request.rb +57 -0
  76. data/lib/groupdocs_viewer_cloud/models/requests/image_delete_pages_cache_request.rb +53 -0
  77. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachment_info_request.rb +69 -0
  78. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachment_info_with_options_request.rb +61 -0
  79. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachment_page_request.rb +105 -0
  80. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachment_pages_request.rb +109 -0
  81. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachment_request.rb +61 -0
  82. data/lib/groupdocs_viewer_cloud/models/requests/image_get_attachments_request.rb +57 -0
  83. data/lib/groupdocs_viewer_cloud/models/requests/image_get_document_info_from_content_request.rb +61 -0
  84. data/lib/groupdocs_viewer_cloud/models/requests/image_get_document_info_from_url_request.rb +73 -0
  85. data/lib/groupdocs_viewer_cloud/models/requests/image_get_document_info_from_url_with_options_request.rb +61 -0
  86. data/lib/groupdocs_viewer_cloud/models/requests/image_get_document_info_request.rb +69 -0
  87. data/lib/groupdocs_viewer_cloud/models/requests/image_get_document_info_with_options_request.rb +57 -0
  88. data/lib/groupdocs_viewer_cloud/models/requests/image_get_page_request.rb +97 -0
  89. data/lib/groupdocs_viewer_cloud/models/requests/image_get_pages_from_url_request.rb +105 -0
  90. data/lib/groupdocs_viewer_cloud/models/requests/image_get_pages_request.rb +101 -0
  91. data/lib/groupdocs_viewer_cloud/models/requests/image_get_pdf_file_from_url_request.rb +77 -0
  92. data/lib/groupdocs_viewer_cloud/models/requests/image_get_pdf_file_request.rb +73 -0
  93. data/lib/groupdocs_viewer_cloud/models/requests/image_get_zip_with_attachment_pages_request.rb +109 -0
  94. data/lib/groupdocs_viewer_cloud/models/requests/image_get_zip_with_pages_request.rb +101 -0
  95. data/lib/groupdocs_viewer_cloud/models/requests/image_transform_pages_request.rb +57 -0
  96. data/lib/groupdocs_viewer_cloud/models/resource.rb +216 -0
  97. data/lib/groupdocs_viewer_cloud/models/resource_url.rb +206 -0
  98. data/lib/groupdocs_viewer_cloud/models/rotate_options.rb +226 -0
  99. data/lib/groupdocs_viewer_cloud/models/row_info.rb +270 -0
  100. data/lib/groupdocs_viewer_cloud/models/slides_options.rb +206 -0
  101. data/lib/groupdocs_viewer_cloud/models/tile.rb +236 -0
  102. data/lib/groupdocs_viewer_cloud/models/transform_options_base.rb +216 -0
  103. data/lib/groupdocs_viewer_cloud/models/watermark.rb +236 -0
  104. data/lib/groupdocs_viewer_cloud/models/words_options.rb +216 -0
  105. data/lib/groupdocs_viewer_cloud/version.rb +29 -0
  106. metadata +235 -0
@@ -0,0 +1,368 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="render_options.rb">
4
+ # Copyright (c) 2003-2018 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsViewerCloud
31
+ # Base render options.
32
+ class RenderOptions
33
+
34
+ # Allows to specify document password in case when document is password-protected.
35
+ attr_accessor :password
36
+
37
+ # Allows to specify attachment password in case when attachment is password-protected.
38
+ attr_accessor :attachment_password
39
+
40
+ # Enables document text extraction. For rendering document as image only.
41
+ attr_accessor :extract_text
42
+
43
+ # Enables document comments rendering.
44
+ attr_accessor :render_comments
45
+
46
+ # Enables rendering of document hidden pages, sheets or slides.
47
+ attr_accessor :render_hidden_pages
48
+
49
+ # Transforms to apply. Available transforms [\"Rotate\",\"Reorder\",\"AddPrintAction\"]. 1. Rotate - pages will be rotated on angle if angle was set before. 2. Reorder - for rendering document as PDF only. Pages will be ordered according to rearrangements made before. 3. AddPrintAction - for rendering document as PDF only. An JavaScript action will be added which opens print dialog when PDF document is opened.
50
+ attr_accessor :transforms
51
+
52
+ # The name of the default font. Default font name may be specified in following cases: - You want to generally specify the default font to fall back on, if particular font in the document cannot be found during rendering. - Your document uses fonts, that contain non-English characters and you want to make sure any missing font is replaced with one that has the same character set available.
53
+ attr_accessor :default_font_name
54
+
55
+ # Allows to specify watermark.
56
+ attr_accessor :watermark
57
+
58
+ # The Spreadsheet documents rendering options.
59
+ attr_accessor :cells_options
60
+
61
+ # The CAD documents rendering options.
62
+ attr_accessor :cad_options
63
+
64
+ # The Email documents rendering options.
65
+ attr_accessor :email_options
66
+
67
+ # The Text documents rendering options.
68
+ attr_accessor :words_options
69
+
70
+ # The PDF documents rendering options.
71
+ attr_accessor :pdf_options
72
+
73
+ # The Presentation documents rendering options.
74
+ attr_accessor :slides_options
75
+
76
+ # The Microsoft Project documents rendering options.
77
+ attr_accessor :project_options
78
+
79
+ # Allows to specify document page number as starting page to render.
80
+ attr_accessor :start_page_number
81
+
82
+ # Allows to specify count of document pages to render.
83
+ attr_accessor :count_pages
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'password' => :'password',
89
+ :'attachment_password' => :'attachmentPassword',
90
+ :'extract_text' => :'extractText',
91
+ :'render_comments' => :'renderComments',
92
+ :'render_hidden_pages' => :'renderHiddenPages',
93
+ :'transforms' => :'transforms',
94
+ :'default_font_name' => :'defaultFontName',
95
+ :'watermark' => :'watermark',
96
+ :'cells_options' => :'cellsOptions',
97
+ :'cad_options' => :'cadOptions',
98
+ :'email_options' => :'emailOptions',
99
+ :'words_options' => :'wordsOptions',
100
+ :'pdf_options' => :'pdfOptions',
101
+ :'slides_options' => :'slidesOptions',
102
+ :'project_options' => :'projectOptions',
103
+ :'start_page_number' => :'startPageNumber',
104
+ :'count_pages' => :'countPages'
105
+ }
106
+ end
107
+
108
+ # Attribute type mapping.
109
+ def self.swagger_types
110
+ {
111
+ :'password' => :'String',
112
+ :'attachment_password' => :'String',
113
+ :'extract_text' => :'BOOLEAN',
114
+ :'render_comments' => :'BOOLEAN',
115
+ :'render_hidden_pages' => :'BOOLEAN',
116
+ :'transforms' => :'Array<String>',
117
+ :'default_font_name' => :'String',
118
+ :'watermark' => :'Watermark',
119
+ :'cells_options' => :'CellsOptions',
120
+ :'cad_options' => :'CadOptions',
121
+ :'email_options' => :'EmailOptions',
122
+ :'words_options' => :'WordsOptions',
123
+ :'pdf_options' => :'PdfOptions',
124
+ :'slides_options' => :'SlidesOptions',
125
+ :'project_options' => :'ProjectOptions',
126
+ :'start_page_number' => :'Integer',
127
+ :'count_pages' => :'Integer'
128
+ }
129
+ end
130
+
131
+ # Initializes the object
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ def initialize(attributes = {})
134
+ return unless attributes.is_a?(Hash)
135
+
136
+ # convert string to symbol for hash key
137
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
138
+
139
+ if attributes.key?(:'password')
140
+ self.password = attributes[:'password']
141
+ end
142
+
143
+ if attributes.key?(:'attachmentPassword')
144
+ self.attachment_password = attributes[:'attachmentPassword']
145
+ end
146
+
147
+ if attributes.key?(:'extractText')
148
+ self.extract_text = attributes[:'extractText']
149
+ end
150
+
151
+ if attributes.key?(:'renderComments')
152
+ self.render_comments = attributes[:'renderComments']
153
+ end
154
+
155
+ if attributes.key?(:'renderHiddenPages')
156
+ self.render_hidden_pages = attributes[:'renderHiddenPages']
157
+ end
158
+
159
+ if attributes.key?(:'transforms')
160
+ if (value = attributes[:'transforms']).is_a?(Array)
161
+ self.transforms = value
162
+ end
163
+ end
164
+
165
+ if attributes.key?(:'defaultFontName')
166
+ self.default_font_name = attributes[:'defaultFontName']
167
+ end
168
+
169
+ if attributes.key?(:'watermark')
170
+ self.watermark = attributes[:'watermark']
171
+ end
172
+
173
+ if attributes.key?(:'cellsOptions')
174
+ self.cells_options = attributes[:'cellsOptions']
175
+ end
176
+
177
+ if attributes.key?(:'cadOptions')
178
+ self.cad_options = attributes[:'cadOptions']
179
+ end
180
+
181
+ if attributes.key?(:'emailOptions')
182
+ self.email_options = attributes[:'emailOptions']
183
+ end
184
+
185
+ if attributes.key?(:'wordsOptions')
186
+ self.words_options = attributes[:'wordsOptions']
187
+ end
188
+
189
+ if attributes.key?(:'pdfOptions')
190
+ self.pdf_options = attributes[:'pdfOptions']
191
+ end
192
+
193
+ if attributes.key?(:'slidesOptions')
194
+ self.slides_options = attributes[:'slidesOptions']
195
+ end
196
+
197
+ if attributes.key?(:'projectOptions')
198
+ self.project_options = attributes[:'projectOptions']
199
+ end
200
+
201
+ if attributes.key?(:'startPageNumber')
202
+ self.start_page_number = attributes[:'startPageNumber']
203
+ end
204
+
205
+ if attributes.key?(:'countPages')
206
+ self.count_pages = attributes[:'countPages']
207
+ end
208
+
209
+ end
210
+
211
+ # Show invalid properties with the reasons. Usually used together with valid?
212
+ # @return Array for valid properies with the reasons
213
+ def list_invalid_properties
214
+ invalid_properties = []
215
+ return invalid_properties
216
+ end
217
+
218
+ # Check to see if the all the properties in the model are valid
219
+ # @return true if the model is valid
220
+ def valid?
221
+ return true
222
+ end
223
+
224
+ # Checks equality by comparing each attribute.
225
+ # @param [Object] Object to be compared
226
+ def ==(other)
227
+ return true if self.equal?(other)
228
+ self.class == other.class &&
229
+ password == other.password &&
230
+ attachment_password == other.attachment_password &&
231
+ extract_text == other.extract_text &&
232
+ render_comments == other.render_comments &&
233
+ render_hidden_pages == other.render_hidden_pages &&
234
+ transforms == other.transforms &&
235
+ default_font_name == other.default_font_name &&
236
+ watermark == other.watermark &&
237
+ cells_options == other.cells_options &&
238
+ cad_options == other.cad_options &&
239
+ email_options == other.email_options &&
240
+ words_options == other.words_options &&
241
+ pdf_options == other.pdf_options &&
242
+ slides_options == other.slides_options &&
243
+ project_options == other.project_options &&
244
+ start_page_number == other.start_page_number &&
245
+ count_pages == other.count_pages
246
+ end
247
+
248
+ # @see the `==` method
249
+ # @param [Object] Object to be compared
250
+ def eql?(other)
251
+ self == other
252
+ end
253
+
254
+ # Calculates hash code according to all attributes.
255
+ # @return [Fixnum] Hash code
256
+ def hash
257
+ [password, attachment_password, extract_text, render_comments, render_hidden_pages, transforms, default_font_name, watermark, cells_options, cad_options, email_options, words_options, pdf_options, slides_options, project_options, start_page_number, count_pages].hash
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def build_from_hash(attributes)
264
+ return nil unless attributes.is_a?(Hash)
265
+ self.class.swagger_types.each_pair do |key, type|
266
+ if type =~ /\AArray<(.*)>/i
267
+ # check to ensure the input is an array given that the the attribute
268
+ # is documented as an array but the input is not
269
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
270
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
271
+ end
272
+ elsif !attributes[self.class.attribute_map[key]].nil?
273
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
274
+ end
275
+ # or else data not found in attributes(hash), not an issue as the data can be optional
276
+ end
277
+
278
+ self
279
+ end
280
+
281
+ # Deserializes the data based on type
282
+ # @param string type Data type
283
+ # @param string value Value to be deserialized
284
+ # @return [Object] Deserialized data
285
+ def _deserialize(type, value)
286
+ case type.to_sym
287
+ when :DateTime
288
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
289
+ when :Date
290
+ Time.at(/\d/.match(value)[0].to_f).to_date
291
+ when :String
292
+ value.to_s
293
+ when :Integer
294
+ value.to_i
295
+ when :Float
296
+ value.to_f
297
+ when :BOOLEAN
298
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
299
+ true
300
+ else
301
+ false
302
+ end
303
+ when :Object
304
+ # generic object (usually a Hash), return directly
305
+ value
306
+ when /\AArray<(?<inner_type>.+)>\z/
307
+ inner_type = Regexp.last_match[:inner_type]
308
+ value.map { |v| _deserialize(inner_type, v) }
309
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
310
+ k_type = Regexp.last_match[:k_type]
311
+ v_type = Regexp.last_match[:v_type]
312
+ {}.tap do |hash|
313
+ value.each do |k, v|
314
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
315
+ end
316
+ end
317
+ else
318
+ # model
319
+ temp_model = GroupDocsViewerCloud.const_get(type).new
320
+ temp_model.build_from_hash(value)
321
+ end
322
+ end
323
+
324
+ # Returns the string representation of the object
325
+ # @return [String] String presentation of the object
326
+ def to_s
327
+ to_hash.to_s
328
+ end
329
+
330
+ # to_body is an alias to to_hash (backward compatibility)
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_body
333
+ to_hash
334
+ end
335
+
336
+ # Returns the object in the form of hash
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_hash
339
+ hash = {}
340
+ self.class.attribute_map.each_pair do |attr, param|
341
+ value = self.send(attr)
342
+ next if value.nil?
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ # Outputs non-array value in the form of hash
349
+ # For object, use to_hash. Otherwise, just return the value
350
+ # @param [Object] value Any valid value
351
+ # @return [Hash] Returns the value in the form of hash
352
+ def _to_hash(value)
353
+ if value.is_a?(Array)
354
+ value.compact.map { |v| _to_hash(v) }
355
+ elsif value.is_a?(Hash)
356
+ {}.tap do |hash|
357
+ value.each { |k, v| hash[k] = _to_hash(v) }
358
+ end
359
+ elsif value.respond_to? :to_hash
360
+ value.to_hash
361
+ else
362
+ value
363
+ end
364
+ end
365
+
366
+ end
367
+
368
+ end
@@ -0,0 +1,348 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="render_options_base.rb">
4
+ # Copyright (c) 2003-2018 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsViewerCloud
31
+ # Base render options.
32
+ class RenderOptionsBase
33
+
34
+ # Allows to specify document password in case when document is password-protected.
35
+ attr_accessor :password
36
+
37
+ # Allows to specify attachment password in case when attachment is password-protected.
38
+ attr_accessor :attachment_password
39
+
40
+ # Enables document text extraction. For rendering document as image only.
41
+ attr_accessor :extract_text
42
+
43
+ # Enables document comments rendering.
44
+ attr_accessor :render_comments
45
+
46
+ # Enables rendering of document hidden pages, sheets or slides.
47
+ attr_accessor :render_hidden_pages
48
+
49
+ # Transforms to apply. Available transforms [\"Rotate\",\"Reorder\",\"AddPrintAction\"]. 1. Rotate - pages will be rotated on angle if angle was set before. 2. Reorder - for rendering document as PDF only. Pages will be ordered according to rearrangements made before. 3. AddPrintAction - for rendering document as PDF only. An JavaScript action will be added which opens print dialog when PDF document is opened.
50
+ attr_accessor :transforms
51
+
52
+ # The name of the default font. Default font name may be specified in following cases: - You want to generally specify the default font to fall back on, if particular font in the document cannot be found during rendering. - Your document uses fonts, that contain non-English characters and you want to make sure any missing font is replaced with one that has the same character set available.
53
+ attr_accessor :default_font_name
54
+
55
+ # Allows to specify watermark.
56
+ attr_accessor :watermark
57
+
58
+ # The Spreadsheet documents rendering options.
59
+ attr_accessor :cells_options
60
+
61
+ # The CAD documents rendering options.
62
+ attr_accessor :cad_options
63
+
64
+ # The Email documents rendering options.
65
+ attr_accessor :email_options
66
+
67
+ # The Text documents rendering options.
68
+ attr_accessor :words_options
69
+
70
+ # The PDF documents rendering options.
71
+ attr_accessor :pdf_options
72
+
73
+ # The Presentation documents rendering options.
74
+ attr_accessor :slides_options
75
+
76
+ # The Microsoft Project documents rendering options.
77
+ attr_accessor :project_options
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'password' => :'password',
83
+ :'attachment_password' => :'attachmentPassword',
84
+ :'extract_text' => :'extractText',
85
+ :'render_comments' => :'renderComments',
86
+ :'render_hidden_pages' => :'renderHiddenPages',
87
+ :'transforms' => :'transforms',
88
+ :'default_font_name' => :'defaultFontName',
89
+ :'watermark' => :'watermark',
90
+ :'cells_options' => :'cellsOptions',
91
+ :'cad_options' => :'cadOptions',
92
+ :'email_options' => :'emailOptions',
93
+ :'words_options' => :'wordsOptions',
94
+ :'pdf_options' => :'pdfOptions',
95
+ :'slides_options' => :'slidesOptions',
96
+ :'project_options' => :'projectOptions'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.swagger_types
102
+ {
103
+ :'password' => :'String',
104
+ :'attachment_password' => :'String',
105
+ :'extract_text' => :'BOOLEAN',
106
+ :'render_comments' => :'BOOLEAN',
107
+ :'render_hidden_pages' => :'BOOLEAN',
108
+ :'transforms' => :'Array<String>',
109
+ :'default_font_name' => :'String',
110
+ :'watermark' => :'Watermark',
111
+ :'cells_options' => :'CellsOptions',
112
+ :'cad_options' => :'CadOptions',
113
+ :'email_options' => :'EmailOptions',
114
+ :'words_options' => :'WordsOptions',
115
+ :'pdf_options' => :'PdfOptions',
116
+ :'slides_options' => :'SlidesOptions',
117
+ :'project_options' => :'ProjectOptions'
118
+ }
119
+ end
120
+
121
+ # Initializes the object
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ def initialize(attributes = {})
124
+ return unless attributes.is_a?(Hash)
125
+
126
+ # convert string to symbol for hash key
127
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
128
+
129
+ if attributes.key?(:'password')
130
+ self.password = attributes[:'password']
131
+ end
132
+
133
+ if attributes.key?(:'attachmentPassword')
134
+ self.attachment_password = attributes[:'attachmentPassword']
135
+ end
136
+
137
+ if attributes.key?(:'extractText')
138
+ self.extract_text = attributes[:'extractText']
139
+ end
140
+
141
+ if attributes.key?(:'renderComments')
142
+ self.render_comments = attributes[:'renderComments']
143
+ end
144
+
145
+ if attributes.key?(:'renderHiddenPages')
146
+ self.render_hidden_pages = attributes[:'renderHiddenPages']
147
+ end
148
+
149
+ if attributes.key?(:'transforms')
150
+ if (value = attributes[:'transforms']).is_a?(Array)
151
+ self.transforms = value
152
+ end
153
+ end
154
+
155
+ if attributes.key?(:'defaultFontName')
156
+ self.default_font_name = attributes[:'defaultFontName']
157
+ end
158
+
159
+ if attributes.key?(:'watermark')
160
+ self.watermark = attributes[:'watermark']
161
+ end
162
+
163
+ if attributes.key?(:'cellsOptions')
164
+ self.cells_options = attributes[:'cellsOptions']
165
+ end
166
+
167
+ if attributes.key?(:'cadOptions')
168
+ self.cad_options = attributes[:'cadOptions']
169
+ end
170
+
171
+ if attributes.key?(:'emailOptions')
172
+ self.email_options = attributes[:'emailOptions']
173
+ end
174
+
175
+ if attributes.key?(:'wordsOptions')
176
+ self.words_options = attributes[:'wordsOptions']
177
+ end
178
+
179
+ if attributes.key?(:'pdfOptions')
180
+ self.pdf_options = attributes[:'pdfOptions']
181
+ end
182
+
183
+ if attributes.key?(:'slidesOptions')
184
+ self.slides_options = attributes[:'slidesOptions']
185
+ end
186
+
187
+ if attributes.key?(:'projectOptions')
188
+ self.project_options = attributes[:'projectOptions']
189
+ end
190
+
191
+ end
192
+
193
+ # Show invalid properties with the reasons. Usually used together with valid?
194
+ # @return Array for valid properies with the reasons
195
+ def list_invalid_properties
196
+ invalid_properties = []
197
+ return invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return true
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(other)
209
+ return true if self.equal?(other)
210
+ self.class == other.class &&
211
+ password == other.password &&
212
+ attachment_password == other.attachment_password &&
213
+ extract_text == other.extract_text &&
214
+ render_comments == other.render_comments &&
215
+ render_hidden_pages == other.render_hidden_pages &&
216
+ transforms == other.transforms &&
217
+ default_font_name == other.default_font_name &&
218
+ watermark == other.watermark &&
219
+ cells_options == other.cells_options &&
220
+ cad_options == other.cad_options &&
221
+ email_options == other.email_options &&
222
+ words_options == other.words_options &&
223
+ pdf_options == other.pdf_options &&
224
+ slides_options == other.slides_options &&
225
+ project_options == other.project_options
226
+ end
227
+
228
+ # @see the `==` method
229
+ # @param [Object] Object to be compared
230
+ def eql?(other)
231
+ self == other
232
+ end
233
+
234
+ # Calculates hash code according to all attributes.
235
+ # @return [Fixnum] Hash code
236
+ def hash
237
+ [password, attachment_password, extract_text, render_comments, render_hidden_pages, transforms, default_font_name, watermark, cells_options, cad_options, email_options, words_options, pdf_options, slides_options, project_options].hash
238
+ end
239
+
240
+ # Builds the object from hash
241
+ # @param [Hash] attributes Model attributes in the form of hash
242
+ # @return [Object] Returns the model itself
243
+ def build_from_hash(attributes)
244
+ return nil unless attributes.is_a?(Hash)
245
+ self.class.swagger_types.each_pair do |key, type|
246
+ if type =~ /\AArray<(.*)>/i
247
+ # check to ensure the input is an array given that the the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
250
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
251
+ end
252
+ elsif !attributes[self.class.attribute_map[key]].nil?
253
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
+ end
255
+ # or else data not found in attributes(hash), not an issue as the data can be optional
256
+ end
257
+
258
+ self
259
+ end
260
+
261
+ # Deserializes the data based on type
262
+ # @param string type Data type
263
+ # @param string value Value to be deserialized
264
+ # @return [Object] Deserialized data
265
+ def _deserialize(type, value)
266
+ case type.to_sym
267
+ when :DateTime
268
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
269
+ when :Date
270
+ Time.at(/\d/.match(value)[0].to_f).to_date
271
+ when :String
272
+ value.to_s
273
+ when :Integer
274
+ value.to_i
275
+ when :Float
276
+ value.to_f
277
+ when :BOOLEAN
278
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
279
+ true
280
+ else
281
+ false
282
+ end
283
+ when :Object
284
+ # generic object (usually a Hash), return directly
285
+ value
286
+ when /\AArray<(?<inner_type>.+)>\z/
287
+ inner_type = Regexp.last_match[:inner_type]
288
+ value.map { |v| _deserialize(inner_type, v) }
289
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
290
+ k_type = Regexp.last_match[:k_type]
291
+ v_type = Regexp.last_match[:v_type]
292
+ {}.tap do |hash|
293
+ value.each do |k, v|
294
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
295
+ end
296
+ end
297
+ else
298
+ # model
299
+ temp_model = GroupDocsViewerCloud.const_get(type).new
300
+ temp_model.build_from_hash(value)
301
+ end
302
+ end
303
+
304
+ # Returns the string representation of the object
305
+ # @return [String] String presentation of the object
306
+ def to_s
307
+ to_hash.to_s
308
+ end
309
+
310
+ # to_body is an alias to to_hash (backward compatibility)
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_body
313
+ to_hash
314
+ end
315
+
316
+ # Returns the object in the form of hash
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_hash
319
+ hash = {}
320
+ self.class.attribute_map.each_pair do |attr, param|
321
+ value = self.send(attr)
322
+ next if value.nil?
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ # Outputs non-array value in the form of hash
329
+ # For object, use to_hash. Otherwise, just return the value
330
+ # @param [Object] value Any valid value
331
+ # @return [Hash] Returns the value in the form of hash
332
+ def _to_hash(value)
333
+ if value.is_a?(Array)
334
+ value.compact.map { |v| _to_hash(v) }
335
+ elsif value.is_a?(Hash)
336
+ {}.tap do |hash|
337
+ value.each { |k, v| hash[k] = _to_hash(v) }
338
+ end
339
+ elsif value.respond_to? :to_hash
340
+ value.to_hash
341
+ else
342
+ value
343
+ end
344
+ end
345
+
346
+ end
347
+
348
+ end