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