groupdocs_viewer_cloud 18.7

Sign up to get free protection for your applications and to get access to all the features.
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,268 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="page_info.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
+ # Page information.
32
+ class PageInfo
33
+
34
+ # Page number.
35
+ attr_accessor :number
36
+
37
+ # Page name.
38
+ attr_accessor :name
39
+
40
+ # Page width.
41
+ attr_accessor :width
42
+
43
+ # Page height.
44
+ attr_accessor :height
45
+
46
+ # Page angle.
47
+ attr_accessor :angle
48
+
49
+ # Page visibility.
50
+ attr_accessor :visible
51
+
52
+ # Page rows.
53
+ attr_accessor :rows
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'number' => :'number',
59
+ :'name' => :'name',
60
+ :'width' => :'width',
61
+ :'height' => :'height',
62
+ :'angle' => :'angle',
63
+ :'visible' => :'visible',
64
+ :'rows' => :'rows'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'number' => :'Integer',
72
+ :'name' => :'String',
73
+ :'width' => :'Integer',
74
+ :'height' => :'Integer',
75
+ :'angle' => :'Integer',
76
+ :'visible' => :'BOOLEAN',
77
+ :'rows' => :'Array<RowInfo>'
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
88
+
89
+ if attributes.key?(:'number')
90
+ self.number = attributes[:'number']
91
+ end
92
+
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ end
96
+
97
+ if attributes.key?(:'width')
98
+ self.width = attributes[:'width']
99
+ end
100
+
101
+ if attributes.key?(:'height')
102
+ self.height = attributes[:'height']
103
+ end
104
+
105
+ if attributes.key?(:'angle')
106
+ self.angle = attributes[:'angle']
107
+ end
108
+
109
+ if attributes.key?(:'visible')
110
+ self.visible = attributes[:'visible']
111
+ end
112
+
113
+ if attributes.key?(:'rows')
114
+ if (value = attributes[:'rows']).is_a?(Array)
115
+ self.rows = value
116
+ end
117
+ end
118
+
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properies with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = []
125
+ return invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(other)
137
+ return true if self.equal?(other)
138
+ self.class == other.class &&
139
+ number == other.number &&
140
+ name == other.name &&
141
+ width == other.width &&
142
+ height == other.height &&
143
+ angle == other.angle &&
144
+ visible == other.visible &&
145
+ rows == other.rows
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(other)
151
+ self == other
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Fixnum] Hash code
156
+ def hash
157
+ [number, name, width, height, angle, visible, rows].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.swagger_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end
175
+ # or else data not found in attributes(hash), not an issue as the data can be optional
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
189
+ when :Date
190
+ Time.at(/\d/.match(value)[0].to_f).to_date
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :BOOLEAN
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else
218
+ # model
219
+ temp_model = GroupDocsViewerCloud.const_get(type).new
220
+ temp_model.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ next if value.nil?
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end
@@ -0,0 +1,208 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="page_info_collection.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
+ # Describes pages information.
32
+ class PageInfoCollection
33
+
34
+ # Pages list.
35
+ attr_accessor :pages
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'pages' => :'pages'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'pages' => :'Array<PageInfo>'
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?(:'pages')
60
+ if (value = attributes[:'pages']).is_a?(Array)
61
+ self.pages = value
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properies with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = []
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(other)
83
+ return true if self.equal?(other)
84
+ self.class == other.class &&
85
+ pages == other.pages
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(other)
91
+ self == other
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [pages].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.swagger_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end
115
+ # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
129
+ when :Date
130
+ Time.at(/\d/.match(value)[0].to_f).to_date
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else
158
+ # model
159
+ temp_model = GroupDocsViewerCloud.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map { |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end