groupdocs_viewer_cloud 19.3 → 20.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/groupdocs_viewer_cloud.rb +21 -3
- data/lib/groupdocs_viewer_cloud/api/file_api.rb +7 -7
- data/lib/groupdocs_viewer_cloud/api/folder_api.rb +7 -7
- data/lib/groupdocs_viewer_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
- data/lib/groupdocs_viewer_cloud/api/{viewer_api.rb → view_api.rb} +22 -168
- data/lib/groupdocs_viewer_cloud/api_client.rb +1 -1
- data/lib/groupdocs_viewer_cloud/api_error.rb +7 -4
- data/lib/groupdocs_viewer_cloud/configuration.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/archive_options.rb +214 -0
- data/lib/groupdocs_viewer_cloud/models/archive_view_info.rb +216 -0
- data/lib/groupdocs_viewer_cloud/models/attachment_info.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/attachment_view.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/cad_options.rb +54 -5
- data/lib/groupdocs_viewer_cloud/models/cad_view_info.rb +228 -0
- data/lib/groupdocs_viewer_cloud/models/character.rb +274 -0
- data/lib/groupdocs_viewer_cloud/models/delete_view_options.rb +15 -5
- data/lib/groupdocs_viewer_cloud/models/disc_usage.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/email_options.rb +44 -2
- data/lib/groupdocs_viewer_cloud/models/error.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/error_details.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/field_label.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_info.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_version.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_versions.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/files_list.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/files_upload_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/format.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/formats_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/html_options.rb +146 -10
- data/lib/groupdocs_viewer_cloud/models/html_resource.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/image_options.rb +86 -7
- data/lib/groupdocs_viewer_cloud/models/info_result.rb +75 -5
- data/lib/groupdocs_viewer_cloud/models/layer.rb +229 -0
- data/lib/groupdocs_viewer_cloud/models/layout.rb +244 -0
- data/lib/groupdocs_viewer_cloud/models/{row.rb → line.rb} +60 -72
- data/lib/groupdocs_viewer_cloud/models/object_exist.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/outlook_options.rb +249 -0
- data/lib/groupdocs_viewer_cloud/models/outlook_view_info.rb +216 -0
- data/lib/groupdocs_viewer_cloud/models/page_info.rb +28 -13
- data/lib/groupdocs_viewer_cloud/models/page_rotation.rb +271 -0
- data/lib/groupdocs_viewer_cloud/models/page_view.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/pdf_document_options.rb +316 -0
- data/lib/groupdocs_viewer_cloud/models/pdf_options.rb +490 -0
- data/lib/groupdocs_viewer_cloud/models/pdf_view_info.rb +219 -0
- data/lib/groupdocs_viewer_cloud/models/project_management_options.rb +66 -3
- data/lib/groupdocs_viewer_cloud/models/project_management_view_info.rb +234 -0
- data/lib/groupdocs_viewer_cloud/models/render_options.rb +89 -10
- data/lib/groupdocs_viewer_cloud/models/resource.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/spreadsheet_options.rb +57 -5
- data/lib/groupdocs_viewer_cloud/models/storage_exist.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/storage_file.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/text_element.rb +274 -0
- data/lib/groupdocs_viewer_cloud/models/tile.rb +264 -0
- data/lib/groupdocs_viewer_cloud/models/view_options.rb +15 -5
- data/lib/groupdocs_viewer_cloud/models/view_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/watermark.rb +44 -2
- data/lib/groupdocs_viewer_cloud/models/word.rb +286 -0
- data/lib/groupdocs_viewer_cloud/models/word_processing_options.rb +219 -0
- data/lib/groupdocs_viewer_cloud/version.rb +2 -2
- metadata +22 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="page_view.rb">
|
|
4
|
-
# Copyright (c) 2003-
|
|
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
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
#
|
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="pdf_document_options.rb">
|
|
4
|
+
# Copyright (c) 2003-2020 Aspose Pty Ltd
|
|
5
|
+
# </copyright>
|
|
6
|
+
# <summary>
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
# </summary>
|
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
require 'date'
|
|
29
|
+
|
|
30
|
+
module GroupDocsViewerCloud
|
|
31
|
+
# Provides options for rendering PDF documents
|
|
32
|
+
class PdfDocumentOptions
|
|
33
|
+
|
|
34
|
+
# Disables chars grouping to keep maximum precision during chars positioning when rendering the page
|
|
35
|
+
attr_accessor :disable_chars_grouping
|
|
36
|
+
|
|
37
|
+
# Enables rendering of text and graphics according to z-order in original PDF document when rendering into HTML
|
|
38
|
+
attr_accessor :enable_layered_rendering
|
|
39
|
+
|
|
40
|
+
# Enables font hinting. The font hinting adjusts the display of an outline font. Supported only for TTF fonts when these fonts are used in source document.
|
|
41
|
+
attr_accessor :enable_font_hinting
|
|
42
|
+
|
|
43
|
+
# When this option enabled the output pages will have the same size in pixels as page size in a source PDF document. By default GroupDocs.Viewer calculates output image page size for better rendering quality. This option is supported when rendering into PNG or JPG formats.
|
|
44
|
+
attr_accessor :render_original_page_size
|
|
45
|
+
|
|
46
|
+
# Specifies output image quality for image resources when rendering into HTML. The default value is Low
|
|
47
|
+
attr_accessor :image_quality
|
|
48
|
+
class EnumAttributeValidator
|
|
49
|
+
attr_reader :datatype
|
|
50
|
+
attr_reader :allowable_values
|
|
51
|
+
|
|
52
|
+
def initialize(datatype, allowable_values)
|
|
53
|
+
@allowable_values = allowable_values.map do |value|
|
|
54
|
+
case datatype.to_s
|
|
55
|
+
when /Integer/i
|
|
56
|
+
value.to_i
|
|
57
|
+
when /Float/i
|
|
58
|
+
value.to_f
|
|
59
|
+
else
|
|
60
|
+
value
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def valid?(value)
|
|
66
|
+
!value || allowable_values.include?(value)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
71
|
+
def self.attribute_map
|
|
72
|
+
{
|
|
73
|
+
:'disable_chars_grouping' => :'DisableCharsGrouping',
|
|
74
|
+
:'enable_layered_rendering' => :'EnableLayeredRendering',
|
|
75
|
+
:'enable_font_hinting' => :'EnableFontHinting',
|
|
76
|
+
:'render_original_page_size' => :'RenderOriginalPageSize',
|
|
77
|
+
:'image_quality' => :'ImageQuality'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attribute type mapping.
|
|
82
|
+
def self.swagger_types
|
|
83
|
+
{
|
|
84
|
+
:'disable_chars_grouping' => :'BOOLEAN',
|
|
85
|
+
:'enable_layered_rendering' => :'BOOLEAN',
|
|
86
|
+
:'enable_font_hinting' => :'BOOLEAN',
|
|
87
|
+
:'render_original_page_size' => :'BOOLEAN',
|
|
88
|
+
:'image_quality' => :'String'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Initializes the object
|
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
94
|
+
def initialize(attributes = {})
|
|
95
|
+
return unless attributes.is_a?(Hash)
|
|
96
|
+
|
|
97
|
+
# convert string to symbol for hash key
|
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'DisableCharsGrouping')
|
|
101
|
+
self.disable_chars_grouping = attributes[:'DisableCharsGrouping']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'EnableLayeredRendering')
|
|
105
|
+
self.enable_layered_rendering = attributes[:'EnableLayeredRendering']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'EnableFontHinting')
|
|
109
|
+
self.enable_font_hinting = attributes[:'EnableFontHinting']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'RenderOriginalPageSize')
|
|
113
|
+
self.render_original_page_size = attributes[:'RenderOriginalPageSize']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'ImageQuality')
|
|
117
|
+
self.image_quality = attributes[:'ImageQuality']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
123
|
+
# @return Array for valid properies with the reasons
|
|
124
|
+
def list_invalid_properties
|
|
125
|
+
invalid_properties = []
|
|
126
|
+
if @disable_chars_grouping.nil?
|
|
127
|
+
invalid_properties.push("invalid value for 'disable_chars_grouping', disable_chars_grouping cannot be nil.")
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if @enable_layered_rendering.nil?
|
|
131
|
+
invalid_properties.push("invalid value for 'enable_layered_rendering', enable_layered_rendering cannot be nil.")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if @enable_font_hinting.nil?
|
|
135
|
+
invalid_properties.push("invalid value for 'enable_font_hinting', enable_font_hinting cannot be nil.")
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if @render_original_page_size.nil?
|
|
139
|
+
invalid_properties.push("invalid value for 'render_original_page_size', render_original_page_size cannot be nil.")
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if @image_quality.nil?
|
|
143
|
+
invalid_properties.push("invalid value for 'image_quality', image_quality cannot be nil.")
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
return invalid_properties
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Check to see if the all the properties in the model are valid
|
|
150
|
+
# @return true if the model is valid
|
|
151
|
+
def valid?
|
|
152
|
+
return false if @disable_chars_grouping.nil?
|
|
153
|
+
return false if @enable_layered_rendering.nil?
|
|
154
|
+
return false if @enable_font_hinting.nil?
|
|
155
|
+
return false if @render_original_page_size.nil?
|
|
156
|
+
return false if @image_quality.nil?
|
|
157
|
+
image_quality_validator = EnumAttributeValidator.new('String', ["Low", "Medium", "High"])
|
|
158
|
+
return false unless image_quality_validator.valid?(@image_quality)
|
|
159
|
+
return true
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
163
|
+
# @param [Object] image_quality Object to be assigned
|
|
164
|
+
def image_quality=(image_quality)
|
|
165
|
+
validator = EnumAttributeValidator.new('String', ["Low", "Medium", "High"])
|
|
166
|
+
if image_quality.to_i == 0
|
|
167
|
+
unless validator.valid?(image_quality)
|
|
168
|
+
raise ArgumentError, "invalid value for 'image_quality', must be one of #{validator.allowable_values}."
|
|
169
|
+
end
|
|
170
|
+
@image_quality = image_quality
|
|
171
|
+
else
|
|
172
|
+
@image_quality = validator.allowable_values[image_quality.to_i]
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Checks equality by comparing each attribute.
|
|
177
|
+
# @param [Object] Object to be compared
|
|
178
|
+
def ==(other)
|
|
179
|
+
return true if self.equal?(other)
|
|
180
|
+
self.class == other.class &&
|
|
181
|
+
disable_chars_grouping == other.disable_chars_grouping &&
|
|
182
|
+
enable_layered_rendering == other.enable_layered_rendering &&
|
|
183
|
+
enable_font_hinting == other.enable_font_hinting &&
|
|
184
|
+
render_original_page_size == other.render_original_page_size &&
|
|
185
|
+
image_quality == other.image_quality
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# @see the `==` method
|
|
189
|
+
# @param [Object] Object to be compared
|
|
190
|
+
def eql?(other)
|
|
191
|
+
self == other
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Calculates hash code according to all attributes.
|
|
195
|
+
# @return [Fixnum] Hash code
|
|
196
|
+
def hash
|
|
197
|
+
[disable_chars_grouping, enable_layered_rendering, enable_font_hinting, render_original_page_size, image_quality].hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Downcases first letter.
|
|
201
|
+
# @return downcased string
|
|
202
|
+
def uncap(str)
|
|
203
|
+
str[0, 1].downcase + str[1..-1]
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Builds the object from hash
|
|
207
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
208
|
+
# @return [Object] Returns the model itself
|
|
209
|
+
def build_from_hash(attributes)
|
|
210
|
+
return nil unless attributes.is_a?(Hash)
|
|
211
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
212
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
|
213
|
+
value = attributes[pname]
|
|
214
|
+
if type =~ /\AArray<(.*)>/i
|
|
215
|
+
# check to ensure the input is an array given that the the attribute
|
|
216
|
+
# is documented as an array but the input is not
|
|
217
|
+
if value.is_a?(Array)
|
|
218
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
|
219
|
+
end
|
|
220
|
+
elsif !value.nil?
|
|
221
|
+
self.send("#{key}=", _deserialize(type, value))
|
|
222
|
+
end
|
|
223
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
self
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Deserializes the data based on type
|
|
230
|
+
# @param string type Data type
|
|
231
|
+
# @param string value Value to be deserialized
|
|
232
|
+
# @return [Object] Deserialized data
|
|
233
|
+
def _deserialize(type, value)
|
|
234
|
+
case type.to_sym
|
|
235
|
+
when :DateTime
|
|
236
|
+
Date.parse value
|
|
237
|
+
when :Date
|
|
238
|
+
Date.parse value
|
|
239
|
+
when :String
|
|
240
|
+
value.to_s
|
|
241
|
+
when :Integer
|
|
242
|
+
value.to_i
|
|
243
|
+
when :Float
|
|
244
|
+
value.to_f
|
|
245
|
+
when :BOOLEAN
|
|
246
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
247
|
+
true
|
|
248
|
+
else
|
|
249
|
+
false
|
|
250
|
+
end
|
|
251
|
+
when :Object
|
|
252
|
+
# generic object (usually a Hash), return directly
|
|
253
|
+
value
|
|
254
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
255
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
256
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
257
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
258
|
+
k_type = Regexp.last_match[:k_type]
|
|
259
|
+
v_type = Regexp.last_match[:v_type]
|
|
260
|
+
{}.tap do |hash|
|
|
261
|
+
value.each do |k, v|
|
|
262
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
else
|
|
266
|
+
# model
|
|
267
|
+
temp_model = GroupDocsViewerCloud.const_get(type).new
|
|
268
|
+
temp_model.build_from_hash(value)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Returns the string representation of the object
|
|
273
|
+
# @return [String] String presentation of the object
|
|
274
|
+
def to_s
|
|
275
|
+
to_hash.to_s
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
|
280
|
+
def to_body
|
|
281
|
+
to_hash
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Returns the object in the form of hash
|
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
|
286
|
+
def to_hash
|
|
287
|
+
hash = {}
|
|
288
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
289
|
+
value = self.send(attr)
|
|
290
|
+
next if value.nil?
|
|
291
|
+
hash[param] = _to_hash(value)
|
|
292
|
+
end
|
|
293
|
+
hash
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Outputs non-array value in the form of hash
|
|
297
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
298
|
+
# @param [Object] value Any valid value
|
|
299
|
+
# @return [Hash] Returns the value in the form of hash
|
|
300
|
+
def _to_hash(value)
|
|
301
|
+
if value.is_a?(Array)
|
|
302
|
+
value.compact.map { |v| _to_hash(v) }
|
|
303
|
+
elsif value.is_a?(Hash)
|
|
304
|
+
{}.tap do |hash|
|
|
305
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
306
|
+
end
|
|
307
|
+
elsif value.respond_to? :to_hash
|
|
308
|
+
value.to_hash
|
|
309
|
+
else
|
|
310
|
+
value
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
end
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
#
|
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="pdf_options.rb">
|
|
4
|
+
# Copyright (c) 2003-2020 Aspose Pty Ltd
|
|
5
|
+
# </copyright>
|
|
6
|
+
# <summary>
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
# </summary>
|
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
require 'date'
|
|
29
|
+
|
|
30
|
+
module GroupDocsViewerCloud
|
|
31
|
+
# Options for rendering document into PDF
|
|
32
|
+
class PdfOptions
|
|
33
|
+
|
|
34
|
+
# Page number from which rendering should be started
|
|
35
|
+
attr_accessor :start_page_number
|
|
36
|
+
|
|
37
|
+
# Count pages which should be rendered
|
|
38
|
+
attr_accessor :count_pages_to_render
|
|
39
|
+
|
|
40
|
+
# Pages list to render. Ignored, if StartPageNumber and CountPagesToRender are provided
|
|
41
|
+
attr_accessor :pages_to_render
|
|
42
|
+
|
|
43
|
+
# Page rotations
|
|
44
|
+
attr_accessor :page_rotations
|
|
45
|
+
|
|
46
|
+
# Default font name may be specified in following cases: - You want to generally specify the default font to fall back on, if particular font in the document cannot be found during rendering. - Your document uses fonts, that contain non-English characters and you want to make sure any missing font is replaced with one that has the same character set available.
|
|
47
|
+
attr_accessor :default_font_name
|
|
48
|
+
|
|
49
|
+
# Default encoding for the plain text files such as .csv, .txt and .eml files when encoding is not specified in header
|
|
50
|
+
attr_accessor :default_encoding
|
|
51
|
+
|
|
52
|
+
# When enabled comments will be rendered to the output
|
|
53
|
+
attr_accessor :render_comments
|
|
54
|
+
|
|
55
|
+
# When enabled notes will be rendered to the output
|
|
56
|
+
attr_accessor :render_notes
|
|
57
|
+
|
|
58
|
+
# When enabled hidden pages, sheets or slides will be rendered to the output
|
|
59
|
+
attr_accessor :render_hidden_pages
|
|
60
|
+
|
|
61
|
+
# Rendering options for Spreadsheet source file formats Spreadsheet file formats include files with extensions: .xls, .xlsx, .xlsm, .xlsb, .csv, .ods, .ots, .xltx, .xltm, .tsv
|
|
62
|
+
attr_accessor :spreadsheet_options
|
|
63
|
+
|
|
64
|
+
# Rendering options for CAD source file formats CAD file formats include files with extensions: .dwg, .dxf, .dgn, .ifc, .stl
|
|
65
|
+
attr_accessor :cad_options
|
|
66
|
+
|
|
67
|
+
# Rendering options for Email source file formats Email file formats include files with extensions: .msg, .eml, .emlx, .ifc, .stl
|
|
68
|
+
attr_accessor :email_options
|
|
69
|
+
|
|
70
|
+
# Rendering options for MS Project source file formats Project file formats include files with extensions: .mpt, .mpp
|
|
71
|
+
attr_accessor :project_management_options
|
|
72
|
+
|
|
73
|
+
# Rendering options for PDF source file formats
|
|
74
|
+
attr_accessor :pdf_document_options
|
|
75
|
+
|
|
76
|
+
# Rendering options for WordProcessing source file formats
|
|
77
|
+
attr_accessor :word_processing_options
|
|
78
|
+
|
|
79
|
+
# Rendering options for Outlook source file formats
|
|
80
|
+
attr_accessor :outlook_options
|
|
81
|
+
|
|
82
|
+
# Rendering options for Archive source file formats
|
|
83
|
+
attr_accessor :archive_options
|
|
84
|
+
|
|
85
|
+
# The quality of the JPG images contained by output PDF document; Valid values are between 1 and 100; Default value is 90
|
|
86
|
+
attr_accessor :jpg_quality
|
|
87
|
+
|
|
88
|
+
# The password required to open the PDF document
|
|
89
|
+
attr_accessor :document_open_password
|
|
90
|
+
|
|
91
|
+
# The password required to change permission settings; Using a permissions password you can restrict printing, modification and data extraction
|
|
92
|
+
attr_accessor :permissions_password
|
|
93
|
+
|
|
94
|
+
# The PDF document permissions such as printing, modification and data extraction
|
|
95
|
+
attr_accessor :permissions
|
|
96
|
+
class EnumAttributeValidator
|
|
97
|
+
attr_reader :datatype
|
|
98
|
+
attr_reader :allowable_values
|
|
99
|
+
|
|
100
|
+
def initialize(datatype, allowable_values)
|
|
101
|
+
@allowable_values = allowable_values.map do |value|
|
|
102
|
+
case datatype.to_s
|
|
103
|
+
when /Integer/i
|
|
104
|
+
value.to_i
|
|
105
|
+
when /Float/i
|
|
106
|
+
value.to_f
|
|
107
|
+
else
|
|
108
|
+
value
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def valid?(value)
|
|
114
|
+
!value || allowable_values.include?(value)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
119
|
+
def self.attribute_map
|
|
120
|
+
{
|
|
121
|
+
:'start_page_number' => :'StartPageNumber',
|
|
122
|
+
:'count_pages_to_render' => :'CountPagesToRender',
|
|
123
|
+
:'pages_to_render' => :'PagesToRender',
|
|
124
|
+
:'page_rotations' => :'PageRotations',
|
|
125
|
+
:'default_font_name' => :'DefaultFontName',
|
|
126
|
+
:'default_encoding' => :'DefaultEncoding',
|
|
127
|
+
:'render_comments' => :'RenderComments',
|
|
128
|
+
:'render_notes' => :'RenderNotes',
|
|
129
|
+
:'render_hidden_pages' => :'RenderHiddenPages',
|
|
130
|
+
:'spreadsheet_options' => :'SpreadsheetOptions',
|
|
131
|
+
:'cad_options' => :'CadOptions',
|
|
132
|
+
:'email_options' => :'EmailOptions',
|
|
133
|
+
:'project_management_options' => :'ProjectManagementOptions',
|
|
134
|
+
:'pdf_document_options' => :'PdfDocumentOptions',
|
|
135
|
+
:'word_processing_options' => :'WordProcessingOptions',
|
|
136
|
+
:'outlook_options' => :'OutlookOptions',
|
|
137
|
+
:'archive_options' => :'ArchiveOptions',
|
|
138
|
+
:'jpg_quality' => :'JpgQuality',
|
|
139
|
+
:'document_open_password' => :'DocumentOpenPassword',
|
|
140
|
+
:'permissions_password' => :'PermissionsPassword',
|
|
141
|
+
:'permissions' => :'Permissions'
|
|
142
|
+
}
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Attribute type mapping.
|
|
146
|
+
def self.swagger_types
|
|
147
|
+
{
|
|
148
|
+
:'start_page_number' => :'Integer',
|
|
149
|
+
:'count_pages_to_render' => :'Integer',
|
|
150
|
+
:'pages_to_render' => :'Array<Integer>',
|
|
151
|
+
:'page_rotations' => :'Array<PageRotation>',
|
|
152
|
+
:'default_font_name' => :'String',
|
|
153
|
+
:'default_encoding' => :'String',
|
|
154
|
+
:'render_comments' => :'BOOLEAN',
|
|
155
|
+
:'render_notes' => :'BOOLEAN',
|
|
156
|
+
:'render_hidden_pages' => :'BOOLEAN',
|
|
157
|
+
:'spreadsheet_options' => :'SpreadsheetOptions',
|
|
158
|
+
:'cad_options' => :'CadOptions',
|
|
159
|
+
:'email_options' => :'EmailOptions',
|
|
160
|
+
:'project_management_options' => :'ProjectManagementOptions',
|
|
161
|
+
:'pdf_document_options' => :'PdfDocumentOptions',
|
|
162
|
+
:'word_processing_options' => :'WordProcessingOptions',
|
|
163
|
+
:'outlook_options' => :'OutlookOptions',
|
|
164
|
+
:'archive_options' => :'ArchiveOptions',
|
|
165
|
+
:'jpg_quality' => :'Integer',
|
|
166
|
+
:'document_open_password' => :'String',
|
|
167
|
+
:'permissions_password' => :'String',
|
|
168
|
+
:'permissions' => :'String'
|
|
169
|
+
}
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Initializes the object
|
|
173
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
174
|
+
def initialize(attributes = {})
|
|
175
|
+
return unless attributes.is_a?(Hash)
|
|
176
|
+
|
|
177
|
+
# convert string to symbol for hash key
|
|
178
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
179
|
+
|
|
180
|
+
if attributes.key?(:'StartPageNumber')
|
|
181
|
+
self.start_page_number = attributes[:'StartPageNumber']
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if attributes.key?(:'CountPagesToRender')
|
|
185
|
+
self.count_pages_to_render = attributes[:'CountPagesToRender']
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
if attributes.key?(:'PagesToRender')
|
|
189
|
+
if (value = attributes[:'PagesToRender']).is_a?(Array)
|
|
190
|
+
self.pages_to_render = value
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if attributes.key?(:'PageRotations')
|
|
195
|
+
if (value = attributes[:'PageRotations']).is_a?(Array)
|
|
196
|
+
self.page_rotations = value
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
if attributes.key?(:'DefaultFontName')
|
|
201
|
+
self.default_font_name = attributes[:'DefaultFontName']
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
if attributes.key?(:'DefaultEncoding')
|
|
205
|
+
self.default_encoding = attributes[:'DefaultEncoding']
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
if attributes.key?(:'RenderComments')
|
|
209
|
+
self.render_comments = attributes[:'RenderComments']
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
if attributes.key?(:'RenderNotes')
|
|
213
|
+
self.render_notes = attributes[:'RenderNotes']
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
if attributes.key?(:'RenderHiddenPages')
|
|
217
|
+
self.render_hidden_pages = attributes[:'RenderHiddenPages']
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if attributes.key?(:'SpreadsheetOptions')
|
|
221
|
+
self.spreadsheet_options = attributes[:'SpreadsheetOptions']
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
if attributes.key?(:'CadOptions')
|
|
225
|
+
self.cad_options = attributes[:'CadOptions']
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if attributes.key?(:'EmailOptions')
|
|
229
|
+
self.email_options = attributes[:'EmailOptions']
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
if attributes.key?(:'ProjectManagementOptions')
|
|
233
|
+
self.project_management_options = attributes[:'ProjectManagementOptions']
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
if attributes.key?(:'PdfDocumentOptions')
|
|
237
|
+
self.pdf_document_options = attributes[:'PdfDocumentOptions']
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
if attributes.key?(:'WordProcessingOptions')
|
|
241
|
+
self.word_processing_options = attributes[:'WordProcessingOptions']
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
if attributes.key?(:'OutlookOptions')
|
|
245
|
+
self.outlook_options = attributes[:'OutlookOptions']
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
if attributes.key?(:'ArchiveOptions')
|
|
249
|
+
self.archive_options = attributes[:'ArchiveOptions']
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
if attributes.key?(:'JpgQuality')
|
|
253
|
+
self.jpg_quality = attributes[:'JpgQuality']
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
if attributes.key?(:'DocumentOpenPassword')
|
|
257
|
+
self.document_open_password = attributes[:'DocumentOpenPassword']
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
if attributes.key?(:'PermissionsPassword')
|
|
261
|
+
self.permissions_password = attributes[:'PermissionsPassword']
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
if attributes.key?(:'Permissions')
|
|
265
|
+
self.permissions = attributes[:'Permissions']
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
271
|
+
# @return Array for valid properies with the reasons
|
|
272
|
+
def list_invalid_properties
|
|
273
|
+
invalid_properties = []
|
|
274
|
+
if @start_page_number.nil?
|
|
275
|
+
invalid_properties.push("invalid value for 'start_page_number', start_page_number cannot be nil.")
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
if @count_pages_to_render.nil?
|
|
279
|
+
invalid_properties.push("invalid value for 'count_pages_to_render', count_pages_to_render cannot be nil.")
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
if @render_comments.nil?
|
|
283
|
+
invalid_properties.push("invalid value for 'render_comments', render_comments cannot be nil.")
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
if @render_notes.nil?
|
|
287
|
+
invalid_properties.push("invalid value for 'render_notes', render_notes cannot be nil.")
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
if @render_hidden_pages.nil?
|
|
291
|
+
invalid_properties.push("invalid value for 'render_hidden_pages', render_hidden_pages cannot be nil.")
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
if @jpg_quality.nil?
|
|
295
|
+
invalid_properties.push("invalid value for 'jpg_quality', jpg_quality cannot be nil.")
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
if @permissions.nil?
|
|
299
|
+
invalid_properties.push("invalid value for 'permissions', permissions cannot be nil.")
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
return invalid_properties
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Check to see if the all the properties in the model are valid
|
|
306
|
+
# @return true if the model is valid
|
|
307
|
+
def valid?
|
|
308
|
+
return false if @start_page_number.nil?
|
|
309
|
+
return false if @count_pages_to_render.nil?
|
|
310
|
+
return false if @render_comments.nil?
|
|
311
|
+
return false if @render_notes.nil?
|
|
312
|
+
return false if @render_hidden_pages.nil?
|
|
313
|
+
return false if @jpg_quality.nil?
|
|
314
|
+
return false if @permissions.nil?
|
|
315
|
+
permissions_validator = EnumAttributeValidator.new('String', ["AllowAll", "DenyPrinting", "DenyModification", "DenyDataExtraction", "DenyAll"])
|
|
316
|
+
return false unless permissions_validator.valid?(@permissions)
|
|
317
|
+
return true
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
321
|
+
# @param [Object] permissions Object to be assigned
|
|
322
|
+
def permissions=(permissions)
|
|
323
|
+
validator = EnumAttributeValidator.new('String', ["AllowAll", "DenyPrinting", "DenyModification", "DenyDataExtraction", "DenyAll"])
|
|
324
|
+
if permissions.to_i == 0
|
|
325
|
+
unless validator.valid?(permissions)
|
|
326
|
+
raise ArgumentError, "invalid value for 'permissions', must be one of #{validator.allowable_values}."
|
|
327
|
+
end
|
|
328
|
+
@permissions = permissions
|
|
329
|
+
else
|
|
330
|
+
@permissions = validator.allowable_values[permissions.to_i]
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Checks equality by comparing each attribute.
|
|
335
|
+
# @param [Object] Object to be compared
|
|
336
|
+
def ==(other)
|
|
337
|
+
return true if self.equal?(other)
|
|
338
|
+
self.class == other.class &&
|
|
339
|
+
start_page_number == other.start_page_number &&
|
|
340
|
+
count_pages_to_render == other.count_pages_to_render &&
|
|
341
|
+
pages_to_render == other.pages_to_render &&
|
|
342
|
+
page_rotations == other.page_rotations &&
|
|
343
|
+
default_font_name == other.default_font_name &&
|
|
344
|
+
default_encoding == other.default_encoding &&
|
|
345
|
+
render_comments == other.render_comments &&
|
|
346
|
+
render_notes == other.render_notes &&
|
|
347
|
+
render_hidden_pages == other.render_hidden_pages &&
|
|
348
|
+
spreadsheet_options == other.spreadsheet_options &&
|
|
349
|
+
cad_options == other.cad_options &&
|
|
350
|
+
email_options == other.email_options &&
|
|
351
|
+
project_management_options == other.project_management_options &&
|
|
352
|
+
pdf_document_options == other.pdf_document_options &&
|
|
353
|
+
word_processing_options == other.word_processing_options &&
|
|
354
|
+
outlook_options == other.outlook_options &&
|
|
355
|
+
archive_options == other.archive_options &&
|
|
356
|
+
jpg_quality == other.jpg_quality &&
|
|
357
|
+
document_open_password == other.document_open_password &&
|
|
358
|
+
permissions_password == other.permissions_password &&
|
|
359
|
+
permissions == other.permissions
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# @see the `==` method
|
|
363
|
+
# @param [Object] Object to be compared
|
|
364
|
+
def eql?(other)
|
|
365
|
+
self == other
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Calculates hash code according to all attributes.
|
|
369
|
+
# @return [Fixnum] Hash code
|
|
370
|
+
def hash
|
|
371
|
+
[start_page_number, count_pages_to_render, pages_to_render, page_rotations, default_font_name, default_encoding, render_comments, render_notes, render_hidden_pages, spreadsheet_options, cad_options, email_options, project_management_options, pdf_document_options, word_processing_options, outlook_options, archive_options, jpg_quality, document_open_password, permissions_password, permissions].hash
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# Downcases first letter.
|
|
375
|
+
# @return downcased string
|
|
376
|
+
def uncap(str)
|
|
377
|
+
str[0, 1].downcase + str[1..-1]
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
# Builds the object from hash
|
|
381
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
382
|
+
# @return [Object] Returns the model itself
|
|
383
|
+
def build_from_hash(attributes)
|
|
384
|
+
return nil unless attributes.is_a?(Hash)
|
|
385
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
386
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
|
387
|
+
value = attributes[pname]
|
|
388
|
+
if type =~ /\AArray<(.*)>/i
|
|
389
|
+
# check to ensure the input is an array given that the the attribute
|
|
390
|
+
# is documented as an array but the input is not
|
|
391
|
+
if value.is_a?(Array)
|
|
392
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
|
393
|
+
end
|
|
394
|
+
elsif !value.nil?
|
|
395
|
+
self.send("#{key}=", _deserialize(type, value))
|
|
396
|
+
end
|
|
397
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
self
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# Deserializes the data based on type
|
|
404
|
+
# @param string type Data type
|
|
405
|
+
# @param string value Value to be deserialized
|
|
406
|
+
# @return [Object] Deserialized data
|
|
407
|
+
def _deserialize(type, value)
|
|
408
|
+
case type.to_sym
|
|
409
|
+
when :DateTime
|
|
410
|
+
Date.parse value
|
|
411
|
+
when :Date
|
|
412
|
+
Date.parse value
|
|
413
|
+
when :String
|
|
414
|
+
value.to_s
|
|
415
|
+
when :Integer
|
|
416
|
+
value.to_i
|
|
417
|
+
when :Float
|
|
418
|
+
value.to_f
|
|
419
|
+
when :BOOLEAN
|
|
420
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
421
|
+
true
|
|
422
|
+
else
|
|
423
|
+
false
|
|
424
|
+
end
|
|
425
|
+
when :Object
|
|
426
|
+
# generic object (usually a Hash), return directly
|
|
427
|
+
value
|
|
428
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
429
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
430
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
431
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
432
|
+
k_type = Regexp.last_match[:k_type]
|
|
433
|
+
v_type = Regexp.last_match[:v_type]
|
|
434
|
+
{}.tap do |hash|
|
|
435
|
+
value.each do |k, v|
|
|
436
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
else
|
|
440
|
+
# model
|
|
441
|
+
temp_model = GroupDocsViewerCloud.const_get(type).new
|
|
442
|
+
temp_model.build_from_hash(value)
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
# Returns the string representation of the object
|
|
447
|
+
# @return [String] String presentation of the object
|
|
448
|
+
def to_s
|
|
449
|
+
to_hash.to_s
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
453
|
+
# @return [Hash] Returns the object in the form of hash
|
|
454
|
+
def to_body
|
|
455
|
+
to_hash
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
# Returns the object in the form of hash
|
|
459
|
+
# @return [Hash] Returns the object in the form of hash
|
|
460
|
+
def to_hash
|
|
461
|
+
hash = {}
|
|
462
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
463
|
+
value = self.send(attr)
|
|
464
|
+
next if value.nil?
|
|
465
|
+
hash[param] = _to_hash(value)
|
|
466
|
+
end
|
|
467
|
+
hash
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
# Outputs non-array value in the form of hash
|
|
471
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
472
|
+
# @param [Object] value Any valid value
|
|
473
|
+
# @return [Hash] Returns the value in the form of hash
|
|
474
|
+
def _to_hash(value)
|
|
475
|
+
if value.is_a?(Array)
|
|
476
|
+
value.compact.map { |v| _to_hash(v) }
|
|
477
|
+
elsif value.is_a?(Hash)
|
|
478
|
+
{}.tap do |hash|
|
|
479
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
480
|
+
end
|
|
481
|
+
elsif value.respond_to? :to_hash
|
|
482
|
+
value.to_hash
|
|
483
|
+
else
|
|
484
|
+
value
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
end
|