groupdocs_viewer_cloud 19.5 → 20.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_viewer_cloud.rb +19 -2
  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 +2 -2
  6. data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
  7. data/lib/groupdocs_viewer_cloud/api/view_api.rb +3 -3
  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 +131 -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 +5 -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 +20 -3
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="info_result.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,25 +31,60 @@ module GroupDocsViewerCloud
31
31
  # View result information
32
32
  class InfoResult
33
33
 
34
+ # File format extension
35
+ attr_accessor :format_extension
36
+
37
+ # File format
38
+ attr_accessor :format
39
+
34
40
  # View result pages
35
41
  attr_accessor :pages
36
42
 
37
43
  # Attachments
38
44
  attr_accessor :attachments
39
45
 
46
+ # Represents view information for archive file
47
+ attr_accessor :archive_view_info
48
+
49
+ # Represents view information for CAD drawing
50
+ attr_accessor :cad_view_info
51
+
52
+ # Represents view information for MS Project document
53
+ attr_accessor :project_management_view_info
54
+
55
+ # Represents view information for Outlook Data file
56
+ attr_accessor :outlook_view_info
57
+
58
+ # Represents view information for PDF document
59
+ attr_accessor :pdf_view_info
60
+
40
61
  # Attribute mapping from ruby-style variable name to JSON key.
41
62
  def self.attribute_map
42
63
  {
64
+ :'format_extension' => :'FormatExtension',
65
+ :'format' => :'Format',
43
66
  :'pages' => :'Pages',
44
- :'attachments' => :'Attachments'
67
+ :'attachments' => :'Attachments',
68
+ :'archive_view_info' => :'ArchiveViewInfo',
69
+ :'cad_view_info' => :'CadViewInfo',
70
+ :'project_management_view_info' => :'ProjectManagementViewInfo',
71
+ :'outlook_view_info' => :'OutlookViewInfo',
72
+ :'pdf_view_info' => :'PdfViewInfo'
45
73
  }
46
74
  end
47
75
 
48
76
  # Attribute type mapping.
49
77
  def self.swagger_types
50
78
  {
79
+ :'format_extension' => :'String',
80
+ :'format' => :'String',
51
81
  :'pages' => :'Array<PageInfo>',
52
- :'attachments' => :'Array<AttachmentInfo>'
82
+ :'attachments' => :'Array<AttachmentInfo>',
83
+ :'archive_view_info' => :'ArchiveViewInfo',
84
+ :'cad_view_info' => :'CadViewInfo',
85
+ :'project_management_view_info' => :'ProjectManagementViewInfo',
86
+ :'outlook_view_info' => :'OutlookViewInfo',
87
+ :'pdf_view_info' => :'PdfViewInfo'
53
88
  }
54
89
  end
55
90
 
@@ -61,6 +96,14 @@ module GroupDocsViewerCloud
61
96
  # convert string to symbol for hash key
62
97
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
98
 
99
+ if attributes.key?(:'FormatExtension')
100
+ self.format_extension = attributes[:'FormatExtension']
101
+ end
102
+
103
+ if attributes.key?(:'Format')
104
+ self.format = attributes[:'Format']
105
+ end
106
+
64
107
  if attributes.key?(:'Pages')
65
108
  if (value = attributes[:'Pages']).is_a?(Array)
66
109
  self.pages = value
@@ -73,6 +116,26 @@ module GroupDocsViewerCloud
73
116
  end
74
117
  end
75
118
 
119
+ if attributes.key?(:'ArchiveViewInfo')
120
+ self.archive_view_info = attributes[:'ArchiveViewInfo']
121
+ end
122
+
123
+ if attributes.key?(:'CadViewInfo')
124
+ self.cad_view_info = attributes[:'CadViewInfo']
125
+ end
126
+
127
+ if attributes.key?(:'ProjectManagementViewInfo')
128
+ self.project_management_view_info = attributes[:'ProjectManagementViewInfo']
129
+ end
130
+
131
+ if attributes.key?(:'OutlookViewInfo')
132
+ self.outlook_view_info = attributes[:'OutlookViewInfo']
133
+ end
134
+
135
+ if attributes.key?(:'PdfViewInfo')
136
+ self.pdf_view_info = attributes[:'PdfViewInfo']
137
+ end
138
+
76
139
  end
77
140
 
78
141
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -93,8 +156,15 @@ module GroupDocsViewerCloud
93
156
  def ==(other)
94
157
  return true if self.equal?(other)
95
158
  self.class == other.class &&
159
+ format_extension == other.format_extension &&
160
+ format == other.format &&
96
161
  pages == other.pages &&
97
- attachments == other.attachments
162
+ attachments == other.attachments &&
163
+ archive_view_info == other.archive_view_info &&
164
+ cad_view_info == other.cad_view_info &&
165
+ project_management_view_info == other.project_management_view_info &&
166
+ outlook_view_info == other.outlook_view_info &&
167
+ pdf_view_info == other.pdf_view_info
98
168
  end
99
169
 
100
170
  # @see the `==` method
@@ -106,7 +176,7 @@ module GroupDocsViewerCloud
106
176
  # Calculates hash code according to all attributes.
107
177
  # @return [Fixnum] Hash code
108
178
  def hash
109
- [pages, attachments].hash
179
+ [format_extension, format, pages, attachments, archive_view_info, cad_view_info, project_management_view_info, outlook_view_info, pdf_view_info].hash
110
180
  end
111
181
 
112
182
  # Downcases first letter.
@@ -0,0 +1,229 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="layer.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
+ # Represents layer contained by the CAD drawing
32
+ class Layer
33
+
34
+ # The name of the layer
35
+ attr_accessor :name
36
+
37
+ # The layer visibility indicator
38
+ attr_accessor :visible
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'name' => :'Name',
44
+ :'visible' => :'Visible'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'name' => :'String',
52
+ :'visible' => :'BOOLEAN'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ if attributes.key?(:'Name')
65
+ self.name = attributes[:'Name']
66
+ end
67
+
68
+ if attributes.key?(:'Visible')
69
+ self.visible = attributes[:'Visible']
70
+ end
71
+
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properies with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = []
78
+ if @visible.nil?
79
+ invalid_properties.push("invalid value for 'visible', visible cannot be nil.")
80
+ end
81
+
82
+ return invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @visible.nil?
89
+ return true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(other)
95
+ return true if self.equal?(other)
96
+ self.class == other.class &&
97
+ name == other.name &&
98
+ visible == other.visible
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(other)
104
+ self == other
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [name, visible].hash
111
+ end
112
+
113
+ # Downcases first letter.
114
+ # @return downcased string
115
+ def uncap(str)
116
+ str[0, 1].downcase + str[1..-1]
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ pname = uncap(self.class.attribute_map[key]).intern
126
+ value = attributes[pname]
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the the attribute
129
+ # is documented as an array but the input is not
130
+ if value.is_a?(Array)
131
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !value.nil?
134
+ self.send("#{key}=", _deserialize(type, value))
135
+ end
136
+ # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ Date.parse value
150
+ when :Date
151
+ Date.parse value
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :BOOLEAN
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else
179
+ # model
180
+ temp_model = GroupDocsViewerCloud.const_get(type).new
181
+ temp_model.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ next if value.nil?
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,244 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="layout.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
+ # Represents layout contained by the CAD drawing
32
+ class Layout
33
+
34
+ # The name of the layout
35
+ attr_accessor :name
36
+
37
+ # The width of the layout
38
+ attr_accessor :width
39
+
40
+ # The height of the layout
41
+ attr_accessor :height
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'name' => :'Name',
47
+ :'width' => :'Width',
48
+ :'height' => :'Height'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'name' => :'String',
56
+ :'width' => :'Float',
57
+ :'height' => :'Float'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.key?(:'Name')
70
+ self.name = attributes[:'Name']
71
+ end
72
+
73
+ if attributes.key?(:'Width')
74
+ self.width = attributes[:'Width']
75
+ end
76
+
77
+ if attributes.key?(:'Height')
78
+ self.height = attributes[:'Height']
79
+ end
80
+
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properies with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = []
87
+ if @width.nil?
88
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
89
+ end
90
+
91
+ if @height.nil?
92
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
93
+ end
94
+
95
+ return invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return false if @width.nil?
102
+ return false if @height.nil?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(other)
109
+ return true if self.equal?(other)
110
+ self.class == other.class &&
111
+ name == other.name &&
112
+ width == other.width &&
113
+ height == other.height
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(other)
119
+ self == other
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [name, width, height].hash
126
+ end
127
+
128
+ # Downcases first letter.
129
+ # @return downcased string
130
+ def uncap(str)
131
+ str[0, 1].downcase + str[1..-1]
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.swagger_types.each_pair do |key, type|
140
+ pname = uncap(self.class.attribute_map[key]).intern
141
+ value = attributes[pname]
142
+ if type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the the attribute
144
+ # is documented as an array but the input is not
145
+ if value.is_a?(Array)
146
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
147
+ end
148
+ elsif !value.nil?
149
+ self.send("#{key}=", _deserialize(type, value))
150
+ end
151
+ # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ Date.parse value
165
+ when :Date
166
+ Date.parse value
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :BOOLEAN
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else
194
+ # model
195
+ temp_model = GroupDocsViewerCloud.const_get(type).new
196
+ temp_model.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ next if value.nil?
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+
242
+ end
243
+
244
+ end