groupdocs_viewer_cloud 19.3 → 20.5

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 +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
@@ -0,0 +1,219 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="pdf_view_info.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 view information for PDF document
32
+ class PdfViewInfo
33
+
34
+ # Indicates if printing of the document is allowed
35
+ attr_accessor :printing_allowed
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'printing_allowed' => :'PrintingAllowed'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'printing_allowed' => :'BOOLEAN'
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?(:'PrintingAllowed')
60
+ self.printing_allowed = attributes[:'PrintingAllowed']
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
+ if @printing_allowed.nil?
70
+ invalid_properties.push("invalid value for 'printing_allowed', printing_allowed cannot be nil.")
71
+ end
72
+
73
+ return invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @printing_allowed.nil?
80
+ return true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(other)
86
+ return true if self.equal?(other)
87
+ self.class == other.class &&
88
+ printing_allowed == other.printing_allowed
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(other)
94
+ self == other
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [printing_allowed].hash
101
+ end
102
+
103
+ # Downcases first letter.
104
+ # @return downcased string
105
+ def uncap(str)
106
+ str[0, 1].downcase + str[1..-1]
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ pname = uncap(self.class.attribute_map[key]).intern
116
+ value = attributes[pname]
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the the attribute
119
+ # is documented as an array but the input is not
120
+ if value.is_a?(Array)
121
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !value.nil?
124
+ self.send("#{key}=", _deserialize(type, value))
125
+ end
126
+ # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :DateTime
139
+ Date.parse value
140
+ when :Date
141
+ Date.parse value
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :BOOLEAN
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else
169
+ # model
170
+ temp_model = GroupDocsViewerCloud.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="project_management_options.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,10 +31,10 @@ module GroupDocsViewerCloud
31
31
  # Rendering options for Project file formats. Project file formats include files with extensions: .mpt, .mpp
32
32
  class ProjectManagementOptions
33
33
 
34
- # The size of the page. Supported values {Unknown|Letter|Ledger|A0|A1|A2|A3}: 1. Unknown - the default, unspecified page size. 2. Letter - the size of the Letter page in points is 792x612. 3. Ledger - the size of the Letter page in points is 1224x792. 4. A0 - the size of the A0 page in points is 3371x2384. 5. A1 - the size of the A1 page in points is 2384x1685. 6. A2 - the size of the A2 page in points is 1684x1190. 7. A3 - the size of the A3 page in points is 1190x842. 8. A4 - the size of the A4 page in points is 842x595.
34
+ # The size of the page.
35
35
  attr_accessor :page_size
36
36
 
37
- # The time unit to use as minimal point. Supported values {Unknown|Days|ThirdsOfMonths|Months}: 1. Unknown - unknown, unspecified time scale. 2. Days - one day interval. 3. ThirdsOfMonths - one third of the month. 4. Months - one month interval.
37
+ # The time unit to use as minimal point.
38
38
  attr_accessor :time_unit
39
39
 
40
40
  # The start date of a Gantt Chart View to render.
@@ -42,6 +42,27 @@ module GroupDocsViewerCloud
42
42
 
43
43
  # The end date of a Gantt Chart View to render.
44
44
  attr_accessor :end_date
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
45
66
 
46
67
  # Attribute mapping from ruby-style variable name to JSON key.
47
68
  def self.attribute_map
@@ -93,6 +114,14 @@ module GroupDocsViewerCloud
93
114
  # @return Array for valid properies with the reasons
94
115
  def list_invalid_properties
95
116
  invalid_properties = []
117
+ if @page_size.nil?
118
+ invalid_properties.push("invalid value for 'page_size', page_size cannot be nil.")
119
+ end
120
+
121
+ if @time_unit.nil?
122
+ invalid_properties.push("invalid value for 'time_unit', time_unit cannot be nil.")
123
+ end
124
+
96
125
  if @start_date.nil?
97
126
  invalid_properties.push("invalid value for 'start_date', start_date cannot be nil.")
98
127
  end
@@ -107,11 +136,45 @@ module GroupDocsViewerCloud
107
136
  # Check to see if the all the properties in the model are valid
108
137
  # @return true if the model is valid
109
138
  def valid?
139
+ return false if @page_size.nil?
140
+ page_size_validator = EnumAttributeValidator.new('String', ["Unspecified", "Letter", "Ledger", "A0", "A1", "A2", "A3", "A4"])
141
+ return false unless page_size_validator.valid?(@page_size)
142
+ return false if @time_unit.nil?
143
+ time_unit_validator = EnumAttributeValidator.new('String', ["Unspecified", "Days", "ThirdsOfMonths", "Months"])
144
+ return false unless time_unit_validator.valid?(@time_unit)
110
145
  return false if @start_date.nil?
111
146
  return false if @end_date.nil?
112
147
  return true
113
148
  end
114
149
 
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] page_size Object to be assigned
152
+ def page_size=(page_size)
153
+ validator = EnumAttributeValidator.new('String', ["Unspecified", "Letter", "Ledger", "A0", "A1", "A2", "A3", "A4"])
154
+ if page_size.to_i == 0
155
+ unless validator.valid?(page_size)
156
+ raise ArgumentError, "invalid value for 'page_size', must be one of #{validator.allowable_values}."
157
+ end
158
+ @page_size = page_size
159
+ else
160
+ @page_size = validator.allowable_values[page_size.to_i]
161
+ end
162
+ end
163
+
164
+ # Custom attribute writer method checking allowed values (enum).
165
+ # @param [Object] time_unit Object to be assigned
166
+ def time_unit=(time_unit)
167
+ validator = EnumAttributeValidator.new('String', ["Unspecified", "Days", "ThirdsOfMonths", "Months"])
168
+ if time_unit.to_i == 0
169
+ unless validator.valid?(time_unit)
170
+ raise ArgumentError, "invalid value for 'time_unit', must be one of #{validator.allowable_values}."
171
+ end
172
+ @time_unit = time_unit
173
+ else
174
+ @time_unit = validator.allowable_values[time_unit.to_i]
175
+ end
176
+ end
177
+
115
178
  # Checks equality by comparing each attribute.
116
179
  # @param [Object] Object to be compared
117
180
  def ==(other)
@@ -0,0 +1,234 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="project_management_view_info.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 view information for MS Project document
32
+ class ProjectManagementViewInfo
33
+
34
+ # The date time from which the project started
35
+ attr_accessor :start_date
36
+
37
+ # The date time when the project is to be completed
38
+ attr_accessor :end_date
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'start_date' => :'StartDate',
44
+ :'end_date' => :'EndDate'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'start_date' => :'DateTime',
52
+ :'end_date' => :'DateTime'
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?(:'StartDate')
65
+ self.start_date = attributes[:'StartDate']
66
+ end
67
+
68
+ if attributes.key?(:'EndDate')
69
+ self.end_date = attributes[:'EndDate']
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 @start_date.nil?
79
+ invalid_properties.push("invalid value for 'start_date', start_date cannot be nil.")
80
+ end
81
+
82
+ if @end_date.nil?
83
+ invalid_properties.push("invalid value for 'end_date', end_date cannot be nil.")
84
+ end
85
+
86
+ return invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if @start_date.nil?
93
+ return false if @end_date.nil?
94
+ return true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(other)
100
+ return true if self.equal?(other)
101
+ self.class == other.class &&
102
+ start_date == other.start_date &&
103
+ end_date == other.end_date
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(other)
109
+ self == other
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [start_date, end_date].hash
116
+ end
117
+
118
+ # Downcases first letter.
119
+ # @return downcased string
120
+ def uncap(str)
121
+ str[0, 1].downcase + str[1..-1]
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ pname = uncap(self.class.attribute_map[key]).intern
131
+ value = attributes[pname]
132
+ if type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the the attribute
134
+ # is documented as an array but the input is not
135
+ if value.is_a?(Array)
136
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !value.nil?
139
+ self.send("#{key}=", _deserialize(type, value))
140
+ end
141
+ # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ Date.parse value
155
+ when :Date
156
+ Date.parse value
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :BOOLEAN
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else
184
+ # model
185
+ temp_model = GroupDocsViewerCloud.const_get(type).new
186
+ temp_model.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end