groupdocs_viewer_cloud 19.3 → 20.5

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_viewer_cloud.rb +21 -3
  3. data/lib/groupdocs_viewer_cloud/api/file_api.rb +7 -7
  4. data/lib/groupdocs_viewer_cloud/api/folder_api.rb +7 -7
  5. data/lib/groupdocs_viewer_cloud/api/info_api.rb +266 -0
  6. data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
  7. data/lib/groupdocs_viewer_cloud/api/{viewer_api.rb → view_api.rb} +22 -168
  8. data/lib/groupdocs_viewer_cloud/api_client.rb +1 -1
  9. data/lib/groupdocs_viewer_cloud/api_error.rb +7 -4
  10. data/lib/groupdocs_viewer_cloud/configuration.rb +1 -1
  11. data/lib/groupdocs_viewer_cloud/models/archive_options.rb +214 -0
  12. data/lib/groupdocs_viewer_cloud/models/archive_view_info.rb +216 -0
  13. data/lib/groupdocs_viewer_cloud/models/attachment_info.rb +1 -1
  14. data/lib/groupdocs_viewer_cloud/models/attachment_view.rb +1 -1
  15. data/lib/groupdocs_viewer_cloud/models/cad_options.rb +54 -5
  16. data/lib/groupdocs_viewer_cloud/models/cad_view_info.rb +228 -0
  17. data/lib/groupdocs_viewer_cloud/models/character.rb +274 -0
  18. data/lib/groupdocs_viewer_cloud/models/delete_view_options.rb +15 -5
  19. data/lib/groupdocs_viewer_cloud/models/disc_usage.rb +1 -1
  20. data/lib/groupdocs_viewer_cloud/models/email_options.rb +44 -2
  21. data/lib/groupdocs_viewer_cloud/models/error.rb +1 -1
  22. data/lib/groupdocs_viewer_cloud/models/error_details.rb +1 -1
  23. data/lib/groupdocs_viewer_cloud/models/field_label.rb +1 -1
  24. data/lib/groupdocs_viewer_cloud/models/file_info.rb +1 -1
  25. data/lib/groupdocs_viewer_cloud/models/file_version.rb +1 -1
  26. data/lib/groupdocs_viewer_cloud/models/file_versions.rb +1 -1
  27. data/lib/groupdocs_viewer_cloud/models/files_list.rb +1 -1
  28. data/lib/groupdocs_viewer_cloud/models/files_upload_result.rb +1 -1
  29. data/lib/groupdocs_viewer_cloud/models/format.rb +1 -1
  30. data/lib/groupdocs_viewer_cloud/models/formats_result.rb +1 -1
  31. data/lib/groupdocs_viewer_cloud/models/html_options.rb +146 -10
  32. data/lib/groupdocs_viewer_cloud/models/html_resource.rb +1 -1
  33. data/lib/groupdocs_viewer_cloud/models/image_options.rb +86 -7
  34. data/lib/groupdocs_viewer_cloud/models/info_result.rb +75 -5
  35. data/lib/groupdocs_viewer_cloud/models/layer.rb +229 -0
  36. data/lib/groupdocs_viewer_cloud/models/layout.rb +244 -0
  37. data/lib/groupdocs_viewer_cloud/models/{row.rb → line.rb} +60 -72
  38. data/lib/groupdocs_viewer_cloud/models/object_exist.rb +1 -1
  39. data/lib/groupdocs_viewer_cloud/models/outlook_options.rb +249 -0
  40. data/lib/groupdocs_viewer_cloud/models/outlook_view_info.rb +216 -0
  41. data/lib/groupdocs_viewer_cloud/models/page_info.rb +28 -13
  42. data/lib/groupdocs_viewer_cloud/models/page_rotation.rb +271 -0
  43. data/lib/groupdocs_viewer_cloud/models/page_view.rb +1 -1
  44. data/lib/groupdocs_viewer_cloud/models/pdf_document_options.rb +316 -0
  45. data/lib/groupdocs_viewer_cloud/models/pdf_options.rb +490 -0
  46. data/lib/groupdocs_viewer_cloud/models/pdf_view_info.rb +219 -0
  47. data/lib/groupdocs_viewer_cloud/models/project_management_options.rb +66 -3
  48. data/lib/groupdocs_viewer_cloud/models/project_management_view_info.rb +234 -0
  49. data/lib/groupdocs_viewer_cloud/models/render_options.rb +89 -10
  50. data/lib/groupdocs_viewer_cloud/models/resource.rb +1 -1
  51. data/lib/groupdocs_viewer_cloud/models/spreadsheet_options.rb +57 -5
  52. data/lib/groupdocs_viewer_cloud/models/storage_exist.rb +1 -1
  53. data/lib/groupdocs_viewer_cloud/models/storage_file.rb +1 -1
  54. data/lib/groupdocs_viewer_cloud/models/text_element.rb +274 -0
  55. data/lib/groupdocs_viewer_cloud/models/tile.rb +264 -0
  56. data/lib/groupdocs_viewer_cloud/models/view_options.rb +15 -5
  57. data/lib/groupdocs_viewer_cloud/models/view_result.rb +1 -1
  58. data/lib/groupdocs_viewer_cloud/models/watermark.rb +44 -2
  59. data/lib/groupdocs_viewer_cloud/models/word.rb +286 -0
  60. data/lib/groupdocs_viewer_cloud/models/word_processing_options.rb +219 -0
  61. data/lib/groupdocs_viewer_cloud/version.rb +2 -2
  62. metadata +22 -4
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="storage.rb">
3
- # Copyright (c) 2003-2019 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -350,7 +350,7 @@ end
350
350
  #
351
351
  # --------------------------------------------------------------------------------------------------------------------
352
352
  # <copyright company="Aspose Pty Ltd" file="get_disc_usage_request.rb">
353
- # Copyright (c) 2003-2019 Aspose Pty Ltd
353
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
354
354
  # </copyright>
355
355
  # <summary>
356
356
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -395,7 +395,7 @@ end
395
395
  #
396
396
  # --------------------------------------------------------------------------------------------------------------------
397
397
  # <copyright company="Aspose Pty Ltd" file="get_file_versions_request.rb">
398
- # Copyright (c) 2003-2019 Aspose Pty Ltd
398
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
399
399
  # </copyright>
400
400
  # <summary>
401
401
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -444,7 +444,7 @@ end
444
444
  #
445
445
  # --------------------------------------------------------------------------------------------------------------------
446
446
  # <copyright company="Aspose Pty Ltd" file="object_exists_request.rb">
447
- # Copyright (c) 2003-2019 Aspose Pty Ltd
447
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
448
448
  # </copyright>
449
449
  # <summary>
450
450
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -497,7 +497,7 @@ end
497
497
  #
498
498
  # --------------------------------------------------------------------------------------------------------------------
499
499
  # <copyright company="Aspose Pty Ltd" file="storage_exists_request.rb">
500
- # Copyright (c) 2003-2019 Aspose Pty Ltd
500
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
501
501
  # </copyright>
502
502
  # <summary>
503
503
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
- # <copyright company="Aspose Pty Ltd" file="viewer.rb">
3
- # Copyright (c) 2003-2019 Aspose Pty Ltd
2
+ # <copyright company="Aspose Pty Ltd" file="view.rb">
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,41 +30,41 @@ module GroupDocsViewerCloud
30
30
  #
31
31
  # GroupDocs.Viewer Cloud API
32
32
  #
33
- class ViewerApi
33
+ class ViewApi
34
34
  attr_accessor :config
35
35
 
36
- #make ViewerApi.new private
36
+ #make ViewApi.new private
37
37
  private_class_method :new
38
38
 
39
- # Initializes new instance of ViewerApi
39
+ # Initializes new instance of ViewApi
40
40
  #
41
41
  # @param [config] Configuration
42
- # @return [ViewerApi] New instance of ViewerApi
42
+ # @return [ViewApi] New instance of ViewApi
43
43
  def initialize(config)
44
44
  @config = config
45
45
  @api_client = ApiClient.new(config)
46
46
  @access_token = nil
47
47
  end
48
48
 
49
- # Initializes new instance of ViewerApi
49
+ # Initializes new instance of ViewApi
50
50
  #
51
51
  # @param [app_sid] Application identifier (App SID)
52
52
  # @param [app_key] Application private key (App Key)
53
- # @return [ViewerApi] New instance of ViewerApi
53
+ # @return [ViewApi] New instance of ViewApi
54
54
  def self.from_keys(app_sid, app_key)
55
55
  config = Configuration.new(app_sid, app_key)
56
56
  return new(config)
57
57
  end
58
58
 
59
- # Initializes new instance of ViewerApi
59
+ # Initializes new instance of ViewApi
60
60
  #
61
61
  # @param [config] Configuration
62
- # @return [ViewerApi] New instance of ViewerApi
62
+ # @return [ViewApi] New instance of ViewApi
63
63
  def self.from_config(config)
64
64
  return new(config)
65
65
  end
66
66
 
67
- # Create new view if it not exists
67
+ # Render document pages
68
68
  #
69
69
  # @param request create_view_request
70
70
  # @return [ViewResult]
@@ -73,7 +73,7 @@ module GroupDocsViewerCloud
73
73
  data
74
74
  end
75
75
 
76
- # Create new view if it not exists
76
+ # Render document pages
77
77
  #
78
78
  # @param request create_view_request
79
79
  # @return [Array<(ViewResult, Fixnum, Hash)>]
@@ -81,9 +81,9 @@ module GroupDocsViewerCloud
81
81
  def create_view_with_http_info(request)
82
82
  raise ArgumentError, 'Incorrect request type' unless request.is_a? CreateViewRequest
83
83
 
84
- @api_client.config.logger.debug 'Calling API: ViewerApi.create_view ...' if @api_client.config.debugging
84
+ @api_client.config.logger.debug 'Calling API: ViewApi.create_view ...' if @api_client.config.debugging
85
85
  # verify the required parameter 'view_options' is set
86
- raise ArgumentError, 'Missing the required parameter view_options when calling ViewerApi.create_view' if @api_client.config.client_side_validation && request.view_options.nil?
86
+ raise ArgumentError, 'Missing the required parameter view_options when calling ViewApi.create_view' if @api_client.config.client_side_validation && request.view_options.nil?
87
87
  # resource path
88
88
  local_var_path = '/viewer/view'
89
89
 
@@ -111,12 +111,12 @@ module GroupDocsViewerCloud
111
111
  return_type: 'ViewResult')
112
112
  if @api_client.config.debugging
113
113
  @api_client.config.logger.debug "API called:
114
- ViewerApi#create_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
114
+ ViewApi#create_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
115
  end
116
116
  [data, status_code, headers]
117
117
  end
118
118
 
119
- # Delete view
119
+ # Delete rendered pages
120
120
  #
121
121
  # @param request delete_view_request
122
122
  # @return [nil]
@@ -125,7 +125,7 @@ module GroupDocsViewerCloud
125
125
  nil
126
126
  end
127
127
 
128
- # Delete view
128
+ # Delete rendered pages
129
129
  #
130
130
  # @param request delete_view_request
131
131
  # @return [Array<(nil, Fixnum, Hash)>]
@@ -133,9 +133,9 @@ module GroupDocsViewerCloud
133
133
  def delete_view_with_http_info(request)
134
134
  raise ArgumentError, 'Incorrect request type' unless request.is_a? DeleteViewRequest
135
135
 
136
- @api_client.config.logger.debug 'Calling API: ViewerApi.delete_view ...' if @api_client.config.debugging
136
+ @api_client.config.logger.debug 'Calling API: ViewApi.delete_view ...' if @api_client.config.debugging
137
137
  # verify the required parameter 'delete_view_options' is set
138
- raise ArgumentError, 'Missing the required parameter delete_view_options when calling ViewerApi.delete_view' if @api_client.config.client_side_validation && request.delete_view_options.nil?
138
+ raise ArgumentError, 'Missing the required parameter delete_view_options when calling ViewApi.delete_view' if @api_client.config.client_side_validation && request.delete_view_options.nil?
139
139
  # resource path
140
140
  local_var_path = '/viewer/view'
141
141
 
@@ -162,108 +162,7 @@ module GroupDocsViewerCloud
162
162
  access_token: get_access_token)
163
163
  if @api_client.config.debugging
164
164
  @api_client.config.logger.debug "API called:
165
- ViewerApi#delete_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
166
- end
167
- [data, status_code, headers]
168
- end
169
-
170
- # Get information about view
171
- #
172
- # @param request get_info_request
173
- # @return [InfoResult]
174
- def get_info(request)
175
- data, _status_code, _headers = get_info_with_http_info(request)
176
- data
177
- end
178
-
179
- # Get information about view
180
- #
181
- # @param request get_info_request
182
- # @return [Array<(InfoResult, Fixnum, Hash)>]
183
- # InfoResult data, response status code and response headers
184
- def get_info_with_http_info(request)
185
- raise ArgumentError, 'Incorrect request type' unless request.is_a? GetInfoRequest
186
-
187
- @api_client.config.logger.debug 'Calling API: ViewerApi.get_info ...' if @api_client.config.debugging
188
- # verify the required parameter 'view_options' is set
189
- raise ArgumentError, 'Missing the required parameter view_options when calling ViewerApi.get_info' if @api_client.config.client_side_validation && request.view_options.nil?
190
- # resource path
191
- local_var_path = '/viewer/info'
192
-
193
- # query parameters
194
- query_params = {}
195
-
196
- # header parameters
197
- header_params = {}
198
- # HTTP header 'Accept' (if needed)
199
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
200
- # HTTP header 'Content-Type'
201
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
202
-
203
- # form parameters
204
- form_params = {}
205
-
206
- # http body (model)
207
- post_body = @api_client.object_to_http_body(request.view_options)
208
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
209
- header_params: header_params,
210
- query_params: query_params,
211
- form_params: form_params,
212
- body: post_body,
213
- access_token: get_access_token,
214
- return_type: 'InfoResult')
215
- if @api_client.config.debugging
216
- @api_client.config.logger.debug "API called:
217
- ViewerApi#get_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
- end
219
- [data, status_code, headers]
220
- end
221
-
222
- # Get supported file formats
223
- #
224
- # @return [FormatsResult]
225
- def get_supported_file_formats()
226
- data, _status_code, _headers = get_supported_file_formats_with_http_info()
227
- data
228
- end
229
-
230
- # Get supported file formats
231
- #
232
-
233
- # @return [Array<(FormatsResult, Fixnum, Hash)>]
234
- # FormatsResult data, response status code and response headers
235
- def get_supported_file_formats_with_http_info()
236
-
237
-
238
- @api_client.config.logger.debug 'Calling API: ViewerApi.get_supported_file_formats ...' if @api_client.config.debugging
239
- # resource path
240
- local_var_path = '/viewer/formats'
241
-
242
- # query parameters
243
- query_params = {}
244
-
245
- # header parameters
246
- header_params = {}
247
- # HTTP header 'Accept' (if needed)
248
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
249
- # HTTP header 'Content-Type'
250
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
251
-
252
- # form parameters
253
- form_params = {}
254
-
255
- # http body (model)
256
- post_body = nil
257
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
258
- header_params: header_params,
259
- query_params: query_params,
260
- form_params: form_params,
261
- body: post_body,
262
- access_token: get_access_token,
263
- return_type: 'FormatsResult')
264
- if @api_client.config.debugging
265
- @api_client.config.logger.debug "API called:
266
- ViewerApi#get_supported_file_formats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
165
+ ViewApi#delete_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
267
166
  end
268
167
  [data, status_code, headers]
269
168
  end
@@ -325,7 +224,7 @@ end
325
224
  #
326
225
  # --------------------------------------------------------------------------------------------------------------------
327
226
  # <copyright company="Aspose Pty Ltd" file="create_view_request.rb">
328
- # Copyright (c) 2003-2019 Aspose Pty Ltd
227
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
329
228
  # </copyright>
330
229
  # <summary>
331
230
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -370,7 +269,7 @@ end
370
269
  #
371
270
  # --------------------------------------------------------------------------------------------------------------------
372
271
  # <copyright company="Aspose Pty Ltd" file="delete_view_request.rb">
373
- # Copyright (c) 2003-2019 Aspose Pty Ltd
272
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
374
273
  # </copyright>
375
274
  # <summary>
376
275
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -412,48 +311,3 @@ module GroupDocsViewerCloud
412
311
  end
413
312
  end
414
313
  end
415
- #
416
- # --------------------------------------------------------------------------------------------------------------------
417
- # <copyright company="Aspose Pty Ltd" file="get_info_request.rb">
418
- # Copyright (c) 2003-2019 Aspose Pty Ltd
419
- # </copyright>
420
- # <summary>
421
- # Permission is hereby granted, free of charge, to any person obtaining a copy
422
- # of this software and associated documentation files (the "Software"), to deal
423
- # in the Software without restriction, including without limitation the rights
424
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
425
- # copies of the Software, and to permit persons to whom the Software is
426
- # furnished to do so, subject to the following conditions:
427
- #
428
- # The above copyright notice and this permission notice shall be included in all
429
- # copies or substantial portions of the Software.
430
- #
431
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
432
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
433
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
434
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
435
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
436
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
437
- # SOFTWARE.
438
- # </summary>
439
- # --------------------------------------------------------------------------------------------------------------------
440
- #
441
-
442
- module GroupDocsViewerCloud
443
-
444
- #
445
- # Request model for get_info operation.
446
- #
447
- class GetInfoRequest
448
-
449
- # View options
450
- attr_accessor :view_options
451
-
452
- #
453
- # Initializes a new instance.
454
- # @param view_options View options
455
- def initialize(view_options)
456
- self.view_options = view_options
457
- end
458
- end
459
- end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_client.rb">
3
- # Copyright (c) 2003-2019 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_error.rb">
3
- # Copyright (c) 2003-2019 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,9 +40,12 @@ module GroupDocsViewerCloud
40
40
  if arg.key?(:response_body) then
41
41
  data = JSON.parse(arg[:response_body], :symbolize_names => true)
42
42
  if !data.nil? && !data[:error].nil? then
43
- @message = data[:error]
44
- elsif !data.nil? && !data[:Error].nil? && !data[:Error][:Message].nil? then
45
- @message = data[:Error][:Message]
43
+ error = data[:error]
44
+ if error.kind_of?(String) then
45
+ @message = error
46
+ else
47
+ @message = error[:message]
48
+ end
46
49
  end
47
50
  end
48
51
 
@@ -1,6 +1,6 @@
1
1
  # ------------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="configuration.rb">
3
- # Copyright (c) 2003-2019 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,214 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="archive_options.rb">
4
+ # Copyright (c) 2003-2020 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
+ # Provides options for rendering archive files
32
+ class ArchiveOptions
33
+
34
+ # The folder inside the archive to be rendered
35
+ attr_accessor :folder
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'folder' => :'Folder'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'folder' => :'String'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ if attributes.key?(:'Folder')
60
+ self.folder = attributes[:'Folder']
61
+ end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properies with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = []
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(other)
81
+ return true if self.equal?(other)
82
+ self.class == other.class &&
83
+ folder == other.folder
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(other)
89
+ self == other
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [folder].hash
96
+ end
97
+
98
+ # Downcases first letter.
99
+ # @return downcased string
100
+ def uncap(str)
101
+ str[0, 1].downcase + str[1..-1]
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.swagger_types.each_pair do |key, type|
110
+ pname = uncap(self.class.attribute_map[key]).intern
111
+ value = attributes[pname]
112
+ if type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the the attribute
114
+ # is documented as an array but the input is not
115
+ if value.is_a?(Array)
116
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !value.nil?
119
+ self.send("#{key}=", _deserialize(type, value))
120
+ end
121
+ # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ Date.parse value
135
+ when :Date
136
+ Date.parse value
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :BOOLEAN
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else
164
+ # model
165
+ temp_model = GroupDocsViewerCloud.const_get(type).new
166
+ temp_model.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ next if value.nil?
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end