groupdocs_viewer_cloud 19.5 → 20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_viewer_cloud.rb +19 -2
- 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 +2 -2
- data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
- data/lib/groupdocs_viewer_cloud/api/view_api.rb +3 -3
- 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 +131 -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 +5 -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 +20 -3
@@ -0,0 +1,264 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="tile.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 drawing region
|
32
|
+
class Tile
|
33
|
+
|
34
|
+
# The X coordinate of the lowest left point on the drawing where the tile begins
|
35
|
+
attr_accessor :start_point_x
|
36
|
+
|
37
|
+
# The Y coordinate of the lowest left point on the drawing where the tile begins
|
38
|
+
attr_accessor :start_point_y
|
39
|
+
|
40
|
+
# The width of the tile in pixels
|
41
|
+
attr_accessor :width
|
42
|
+
|
43
|
+
# The height of the tile in pixels
|
44
|
+
attr_accessor :height
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'start_point_x' => :'StartPointX',
|
50
|
+
:'start_point_y' => :'StartPointY',
|
51
|
+
:'width' => :'Width',
|
52
|
+
:'height' => :'Height'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'start_point_x' => :'Integer',
|
60
|
+
:'start_point_y' => :'Integer',
|
61
|
+
:'width' => :'Integer',
|
62
|
+
:'height' => :'Integer'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
return unless attributes.is_a?(Hash)
|
70
|
+
|
71
|
+
# convert string to symbol for hash key
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
73
|
+
|
74
|
+
if attributes.key?(:'StartPointX')
|
75
|
+
self.start_point_x = attributes[:'StartPointX']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'StartPointY')
|
79
|
+
self.start_point_y = attributes[:'StartPointY']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'Width')
|
83
|
+
self.width = attributes[:'Width']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'Height')
|
87
|
+
self.height = attributes[:'Height']
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properies with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = []
|
96
|
+
if @start_point_x.nil?
|
97
|
+
invalid_properties.push("invalid value for 'start_point_x', start_point_x cannot be nil.")
|
98
|
+
end
|
99
|
+
|
100
|
+
if @start_point_y.nil?
|
101
|
+
invalid_properties.push("invalid value for 'start_point_y', start_point_y cannot be nil.")
|
102
|
+
end
|
103
|
+
|
104
|
+
if @width.nil?
|
105
|
+
invalid_properties.push("invalid value for 'width', width cannot be nil.")
|
106
|
+
end
|
107
|
+
|
108
|
+
if @height.nil?
|
109
|
+
invalid_properties.push("invalid value for 'height', height cannot be nil.")
|
110
|
+
end
|
111
|
+
|
112
|
+
return invalid_properties
|
113
|
+
end
|
114
|
+
|
115
|
+
# Check to see if the all the properties in the model are valid
|
116
|
+
# @return true if the model is valid
|
117
|
+
def valid?
|
118
|
+
return false if @start_point_x.nil?
|
119
|
+
return false if @start_point_y.nil?
|
120
|
+
return false if @width.nil?
|
121
|
+
return false if @height.nil?
|
122
|
+
return true
|
123
|
+
end
|
124
|
+
|
125
|
+
# Checks equality by comparing each attribute.
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def ==(other)
|
128
|
+
return true if self.equal?(other)
|
129
|
+
self.class == other.class &&
|
130
|
+
start_point_x == other.start_point_x &&
|
131
|
+
start_point_y == other.start_point_y &&
|
132
|
+
width == other.width &&
|
133
|
+
height == other.height
|
134
|
+
end
|
135
|
+
|
136
|
+
# @see the `==` method
|
137
|
+
# @param [Object] Object to be compared
|
138
|
+
def eql?(other)
|
139
|
+
self == other
|
140
|
+
end
|
141
|
+
|
142
|
+
# Calculates hash code according to all attributes.
|
143
|
+
# @return [Fixnum] Hash code
|
144
|
+
def hash
|
145
|
+
[start_point_x, start_point_y, width, height].hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# Downcases first letter.
|
149
|
+
# @return downcased string
|
150
|
+
def uncap(str)
|
151
|
+
str[0, 1].downcase + str[1..-1]
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.swagger_types.each_pair do |key, type|
|
160
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
161
|
+
value = attributes[pname]
|
162
|
+
if type =~ /\AArray<(.*)>/i
|
163
|
+
# check to ensure the input is an array given that the the attribute
|
164
|
+
# is documented as an array but the input is not
|
165
|
+
if value.is_a?(Array)
|
166
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
167
|
+
end
|
168
|
+
elsif !value.nil?
|
169
|
+
self.send("#{key}=", _deserialize(type, value))
|
170
|
+
end
|
171
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
172
|
+
end
|
173
|
+
|
174
|
+
self
|
175
|
+
end
|
176
|
+
|
177
|
+
# Deserializes the data based on type
|
178
|
+
# @param string type Data type
|
179
|
+
# @param string value Value to be deserialized
|
180
|
+
# @return [Object] Deserialized data
|
181
|
+
def _deserialize(type, value)
|
182
|
+
case type.to_sym
|
183
|
+
when :DateTime
|
184
|
+
Date.parse value
|
185
|
+
when :Date
|
186
|
+
Date.parse value
|
187
|
+
when :String
|
188
|
+
value.to_s
|
189
|
+
when :Integer
|
190
|
+
value.to_i
|
191
|
+
when :Float
|
192
|
+
value.to_f
|
193
|
+
when :BOOLEAN
|
194
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
195
|
+
true
|
196
|
+
else
|
197
|
+
false
|
198
|
+
end
|
199
|
+
when :Object
|
200
|
+
# generic object (usually a Hash), return directly
|
201
|
+
value
|
202
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
203
|
+
inner_type = Regexp.last_match[:inner_type]
|
204
|
+
value.map { |v| _deserialize(inner_type, v) }
|
205
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
206
|
+
k_type = Regexp.last_match[:k_type]
|
207
|
+
v_type = Regexp.last_match[:v_type]
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each do |k, v|
|
210
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
else
|
214
|
+
# model
|
215
|
+
temp_model = GroupDocsViewerCloud.const_get(type).new
|
216
|
+
temp_model.build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
next if value.nil?
|
239
|
+
hash[param] = _to_hash(value)
|
240
|
+
end
|
241
|
+
hash
|
242
|
+
end
|
243
|
+
|
244
|
+
# Outputs non-array value in the form of hash
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
246
|
+
# @param [Object] value Any valid value
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
248
|
+
def _to_hash(value)
|
249
|
+
if value.is_a?(Array)
|
250
|
+
value.compact.map { |v| _to_hash(v) }
|
251
|
+
elsif value.is_a?(Hash)
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
254
|
+
end
|
255
|
+
elsif value.respond_to? :to_hash
|
256
|
+
value.to_hash
|
257
|
+
else
|
258
|
+
value
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="view_options.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
|
@@ -34,10 +34,10 @@ module GroupDocsViewerCloud
|
|
34
34
|
# File info
|
35
35
|
attr_accessor :file_info
|
36
36
|
|
37
|
-
# View format (HTML, PNG, JPG,
|
37
|
+
# View format (HTML, PNG, JPG, or PDF) Default value is HTML.
|
38
38
|
attr_accessor :view_format
|
39
39
|
|
40
|
-
# The output path
|
40
|
+
# The output path Default value is 'viewer\\{input file path}_{file extension}\\'
|
41
41
|
attr_accessor :output_path
|
42
42
|
|
43
43
|
# The path to directory containing custom fonts in storage
|
@@ -143,7 +143,7 @@ module GroupDocsViewerCloud
|
|
143
143
|
# @return true if the model is valid
|
144
144
|
def valid?
|
145
145
|
return false if @view_format.nil?
|
146
|
-
view_format_validator = EnumAttributeValidator.new('String', ["HTML", "PNG", "JPG", "
|
146
|
+
view_format_validator = EnumAttributeValidator.new('String', ["HTML", "PNG", "JPG", "PDF"])
|
147
147
|
return false unless view_format_validator.valid?(@view_format)
|
148
148
|
return true
|
149
149
|
end
|
@@ -151,7 +151,7 @@ module GroupDocsViewerCloud
|
|
151
151
|
# Custom attribute writer method checking allowed values (enum).
|
152
152
|
# @param [Object] view_format Object to be assigned
|
153
153
|
def view_format=(view_format)
|
154
|
-
validator = EnumAttributeValidator.new('String', ["HTML", "PNG", "JPG", "
|
154
|
+
validator = EnumAttributeValidator.new('String', ["HTML", "PNG", "JPG", "PDF"])
|
155
155
|
if view_format.to_i == 0
|
156
156
|
unless validator.valid?(view_format)
|
157
157
|
raise ArgumentError, "invalid value for 'view_format', must be one of #{validator.allowable_values}."
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="view_result.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
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="watermark.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
|
@@ -37,11 +37,32 @@ module GroupDocsViewerCloud
|
|
37
37
|
# Watermark color. Supported formats {Magenta|(112,222,11)|(50,112,222,11)}. Default value is \"Red\".
|
38
38
|
attr_accessor :color
|
39
39
|
|
40
|
-
# Watermark position.
|
40
|
+
# Watermark position. Default value is \"Diagonal\".
|
41
41
|
attr_accessor :position
|
42
42
|
|
43
43
|
# Watermark size in percents. Default value is 100.
|
44
44
|
attr_accessor :size
|
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,10 @@ module GroupDocsViewerCloud
|
|
93
114
|
# @return Array for valid properies with the reasons
|
94
115
|
def list_invalid_properties
|
95
116
|
invalid_properties = []
|
117
|
+
if @position.nil?
|
118
|
+
invalid_properties.push("invalid value for 'position', position cannot be nil.")
|
119
|
+
end
|
120
|
+
|
96
121
|
if @size.nil?
|
97
122
|
invalid_properties.push("invalid value for 'size', size cannot be nil.")
|
98
123
|
end
|
@@ -103,10 +128,27 @@ module GroupDocsViewerCloud
|
|
103
128
|
# Check to see if the all the properties in the model are valid
|
104
129
|
# @return true if the model is valid
|
105
130
|
def valid?
|
131
|
+
return false if @position.nil?
|
132
|
+
position_validator = EnumAttributeValidator.new('String', ["Diagonal", "TopLeft", "TopCenter", "TopRight", "BottomLeft", "BottomCenter", "BottomRight"])
|
133
|
+
return false unless position_validator.valid?(@position)
|
106
134
|
return false if @size.nil?
|
107
135
|
return true
|
108
136
|
end
|
109
137
|
|
138
|
+
# Custom attribute writer method checking allowed values (enum).
|
139
|
+
# @param [Object] position Object to be assigned
|
140
|
+
def position=(position)
|
141
|
+
validator = EnumAttributeValidator.new('String', ["Diagonal", "TopLeft", "TopCenter", "TopRight", "BottomLeft", "BottomCenter", "BottomRight"])
|
142
|
+
if position.to_i == 0
|
143
|
+
unless validator.valid?(position)
|
144
|
+
raise ArgumentError, "invalid value for 'position', must be one of #{validator.allowable_values}."
|
145
|
+
end
|
146
|
+
@position = position
|
147
|
+
else
|
148
|
+
@position = validator.allowable_values[position.to_i]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
110
152
|
# Checks equality by comparing each attribute.
|
111
153
|
# @param [Object] Object to be compared
|
112
154
|
def ==(other)
|
@@ -0,0 +1,286 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="word.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 relatively positioned rectangle which contains single word
|
32
|
+
class Word
|
33
|
+
|
34
|
+
# The X coordinate of the highest left point on the page layout where the rectangle that contains element begins.
|
35
|
+
attr_accessor :x
|
36
|
+
|
37
|
+
# The Y coordinate of the highest left point on the page layout where the rectangle that contains element begins.
|
38
|
+
attr_accessor :y
|
39
|
+
|
40
|
+
# The width of the rectangle which contains the element (in pixels).
|
41
|
+
attr_accessor :width
|
42
|
+
|
43
|
+
# The height of the rectangle which contains the element (in pixels).
|
44
|
+
attr_accessor :height
|
45
|
+
|
46
|
+
# The element value
|
47
|
+
attr_accessor :value
|
48
|
+
|
49
|
+
# The characters contained by the word
|
50
|
+
attr_accessor :characters
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'x' => :'X',
|
56
|
+
:'y' => :'Y',
|
57
|
+
:'width' => :'Width',
|
58
|
+
:'height' => :'Height',
|
59
|
+
:'value' => :'Value',
|
60
|
+
:'characters' => :'Characters'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.swagger_types
|
66
|
+
{
|
67
|
+
:'x' => :'Float',
|
68
|
+
:'y' => :'Float',
|
69
|
+
:'width' => :'Float',
|
70
|
+
:'height' => :'Float',
|
71
|
+
:'value' => :'String',
|
72
|
+
:'characters' => :'Array<Character>'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Initializes the object
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
def initialize(attributes = {})
|
79
|
+
return unless attributes.is_a?(Hash)
|
80
|
+
|
81
|
+
# convert string to symbol for hash key
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
83
|
+
|
84
|
+
if attributes.key?(:'X')
|
85
|
+
self.x = attributes[:'X']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'Y')
|
89
|
+
self.y = attributes[:'Y']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'Width')
|
93
|
+
self.width = attributes[:'Width']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'Height')
|
97
|
+
self.height = attributes[:'Height']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'Value')
|
101
|
+
self.value = attributes[:'Value']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'Characters')
|
105
|
+
if (value = attributes[:'Characters']).is_a?(Array)
|
106
|
+
self.characters = value
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
113
|
+
# @return Array for valid properies with the reasons
|
114
|
+
def list_invalid_properties
|
115
|
+
invalid_properties = []
|
116
|
+
if @x.nil?
|
117
|
+
invalid_properties.push("invalid value for 'x', x cannot be nil.")
|
118
|
+
end
|
119
|
+
|
120
|
+
if @y.nil?
|
121
|
+
invalid_properties.push("invalid value for 'y', y cannot be nil.")
|
122
|
+
end
|
123
|
+
|
124
|
+
if @width.nil?
|
125
|
+
invalid_properties.push("invalid value for 'width', width cannot be nil.")
|
126
|
+
end
|
127
|
+
|
128
|
+
if @height.nil?
|
129
|
+
invalid_properties.push("invalid value for 'height', height cannot be nil.")
|
130
|
+
end
|
131
|
+
|
132
|
+
return invalid_properties
|
133
|
+
end
|
134
|
+
|
135
|
+
# Check to see if the all the properties in the model are valid
|
136
|
+
# @return true if the model is valid
|
137
|
+
def valid?
|
138
|
+
return false if @x.nil?
|
139
|
+
return false if @y.nil?
|
140
|
+
return false if @width.nil?
|
141
|
+
return false if @height.nil?
|
142
|
+
return true
|
143
|
+
end
|
144
|
+
|
145
|
+
# Checks equality by comparing each attribute.
|
146
|
+
# @param [Object] Object to be compared
|
147
|
+
def ==(other)
|
148
|
+
return true if self.equal?(other)
|
149
|
+
self.class == other.class &&
|
150
|
+
x == other.x &&
|
151
|
+
y == other.y &&
|
152
|
+
width == other.width &&
|
153
|
+
height == other.height &&
|
154
|
+
value == other.value &&
|
155
|
+
characters == other.characters
|
156
|
+
end
|
157
|
+
|
158
|
+
# @see the `==` method
|
159
|
+
# @param [Object] Object to be compared
|
160
|
+
def eql?(other)
|
161
|
+
self == other
|
162
|
+
end
|
163
|
+
|
164
|
+
# Calculates hash code according to all attributes.
|
165
|
+
# @return [Fixnum] Hash code
|
166
|
+
def hash
|
167
|
+
[x, y, width, height, value, characters].hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Downcases first letter.
|
171
|
+
# @return downcased string
|
172
|
+
def uncap(str)
|
173
|
+
str[0, 1].downcase + str[1..-1]
|
174
|
+
end
|
175
|
+
|
176
|
+
# Builds the object from hash
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
+
# @return [Object] Returns the model itself
|
179
|
+
def build_from_hash(attributes)
|
180
|
+
return nil unless attributes.is_a?(Hash)
|
181
|
+
self.class.swagger_types.each_pair do |key, type|
|
182
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
183
|
+
value = attributes[pname]
|
184
|
+
if type =~ /\AArray<(.*)>/i
|
185
|
+
# check to ensure the input is an array given that the the attribute
|
186
|
+
# is documented as an array but the input is not
|
187
|
+
if value.is_a?(Array)
|
188
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
189
|
+
end
|
190
|
+
elsif !value.nil?
|
191
|
+
self.send("#{key}=", _deserialize(type, value))
|
192
|
+
end
|
193
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
194
|
+
end
|
195
|
+
|
196
|
+
self
|
197
|
+
end
|
198
|
+
|
199
|
+
# Deserializes the data based on type
|
200
|
+
# @param string type Data type
|
201
|
+
# @param string value Value to be deserialized
|
202
|
+
# @return [Object] Deserialized data
|
203
|
+
def _deserialize(type, value)
|
204
|
+
case type.to_sym
|
205
|
+
when :DateTime
|
206
|
+
Date.parse value
|
207
|
+
when :Date
|
208
|
+
Date.parse value
|
209
|
+
when :String
|
210
|
+
value.to_s
|
211
|
+
when :Integer
|
212
|
+
value.to_i
|
213
|
+
when :Float
|
214
|
+
value.to_f
|
215
|
+
when :BOOLEAN
|
216
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
217
|
+
true
|
218
|
+
else
|
219
|
+
false
|
220
|
+
end
|
221
|
+
when :Object
|
222
|
+
# generic object (usually a Hash), return directly
|
223
|
+
value
|
224
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
225
|
+
inner_type = Regexp.last_match[:inner_type]
|
226
|
+
value.map { |v| _deserialize(inner_type, v) }
|
227
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
228
|
+
k_type = Regexp.last_match[:k_type]
|
229
|
+
v_type = Regexp.last_match[:v_type]
|
230
|
+
{}.tap do |hash|
|
231
|
+
value.each do |k, v|
|
232
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
else
|
236
|
+
# model
|
237
|
+
temp_model = GroupDocsViewerCloud.const_get(type).new
|
238
|
+
temp_model.build_from_hash(value)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Returns the string representation of the object
|
243
|
+
# @return [String] String presentation of the object
|
244
|
+
def to_s
|
245
|
+
to_hash.to_s
|
246
|
+
end
|
247
|
+
|
248
|
+
# to_body is an alias to to_hash (backward compatibility)
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
250
|
+
def to_body
|
251
|
+
to_hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the object in the form of hash
|
255
|
+
# @return [Hash] Returns the object in the form of hash
|
256
|
+
def to_hash
|
257
|
+
hash = {}
|
258
|
+
self.class.attribute_map.each_pair do |attr, param|
|
259
|
+
value = self.send(attr)
|
260
|
+
next if value.nil?
|
261
|
+
hash[param] = _to_hash(value)
|
262
|
+
end
|
263
|
+
hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Outputs non-array value in the form of hash
|
267
|
+
# For object, use to_hash. Otherwise, just return the value
|
268
|
+
# @param [Object] value Any valid value
|
269
|
+
# @return [Hash] Returns the value in the form of hash
|
270
|
+
def _to_hash(value)
|
271
|
+
if value.is_a?(Array)
|
272
|
+
value.compact.map { |v| _to_hash(v) }
|
273
|
+
elsif value.is_a?(Hash)
|
274
|
+
{}.tap do |hash|
|
275
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
276
|
+
end
|
277
|
+
elsif value.respond_to? :to_hash
|
278
|
+
value.to_hash
|
279
|
+
else
|
280
|
+
value
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|