groupdocs_annotation_cloud 18.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +344 -0
- data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +218 -0
- data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +395 -0
- data/lib/groupdocs_annotation_cloud/api/pdf_file_api.rb +281 -0
- data/lib/groupdocs_annotation_cloud/api_client.rb +390 -0
- data/lib/groupdocs_annotation_cloud/api_error.rb +56 -0
- data/lib/groupdocs_annotation_cloud/configuration.rb +95 -0
- data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +236 -0
- data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +504 -0
- data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +271 -0
- data/lib/groupdocs_annotation_cloud/models/document_info.rb +264 -0
- data/lib/groupdocs_annotation_cloud/models/image_page.rb +214 -0
- data/lib/groupdocs_annotation_cloud/models/image_pages.rb +219 -0
- data/lib/groupdocs_annotation_cloud/models/link.rb +236 -0
- data/lib/groupdocs_annotation_cloud/models/link_element.rb +206 -0
- data/lib/groupdocs_annotation_cloud/models/page_info.rb +258 -0
- data/lib/groupdocs_annotation_cloud/models/point.rb +216 -0
- data/lib/groupdocs_annotation_cloud/models/rectangle.rb +236 -0
- data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +49 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +49 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +53 -0
- data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +57 -0
- data/lib/groupdocs_annotation_cloud/models/row_info.rb +276 -0
- data/lib/groupdocs_annotation_cloud/models/value_type.rb +196 -0
- data/lib/groupdocs_annotation_cloud/version.rb +29 -0
- data/lib/groupdocs_annotation_cloud.rb +80 -0
- metadata +164 -0
@@ -0,0 +1,271 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="annotation_reply_info.rb">
|
4
|
+
# Copyright (c) 2003-2018 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsAnnotationCloud
|
31
|
+
|
32
|
+
class AnnotationReplyInfo
|
33
|
+
|
34
|
+
# Gets or sets the unique identifier.
|
35
|
+
attr_accessor :guid
|
36
|
+
|
37
|
+
# Gets or sets the user unique identifier.
|
38
|
+
attr_accessor :user_guid
|
39
|
+
|
40
|
+
# Gets or sets the name of the user.
|
41
|
+
attr_accessor :user_name
|
42
|
+
|
43
|
+
# Gets or sets the user email.
|
44
|
+
attr_accessor :user_email
|
45
|
+
|
46
|
+
# Gets or sets the message.
|
47
|
+
attr_accessor :message
|
48
|
+
|
49
|
+
# Gets or sets the replied on.
|
50
|
+
attr_accessor :replied_on
|
51
|
+
|
52
|
+
# Gets or sets the parent reply unique identifier.
|
53
|
+
attr_accessor :parent_reply_guid
|
54
|
+
|
55
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
56
|
+
def self.attribute_map
|
57
|
+
{
|
58
|
+
:'guid' => :'guid',
|
59
|
+
:'user_guid' => :'userGuid',
|
60
|
+
:'user_name' => :'userName',
|
61
|
+
:'user_email' => :'userEmail',
|
62
|
+
:'message' => :'message',
|
63
|
+
:'replied_on' => :'repliedOn',
|
64
|
+
:'parent_reply_guid' => :'parentReplyGuid'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.swagger_types
|
70
|
+
{
|
71
|
+
:'guid' => :'String',
|
72
|
+
:'user_guid' => :'String',
|
73
|
+
:'user_name' => :'String',
|
74
|
+
:'user_email' => :'String',
|
75
|
+
:'message' => :'String',
|
76
|
+
:'replied_on' => :'DateTime',
|
77
|
+
:'parent_reply_guid' => :'String'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# Initializes the object
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
def initialize(attributes = {})
|
84
|
+
return unless attributes.is_a?(Hash)
|
85
|
+
|
86
|
+
# convert string to symbol for hash key
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
88
|
+
|
89
|
+
if attributes.key?(:'Guid')
|
90
|
+
self.guid = attributes[:'Guid']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'UserGuid')
|
94
|
+
self.user_guid = attributes[:'UserGuid']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'UserName')
|
98
|
+
self.user_name = attributes[:'UserName']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'UserEmail')
|
102
|
+
self.user_email = attributes[:'UserEmail']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'Message')
|
106
|
+
self.message = attributes[:'Message']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'RepliedOn')
|
110
|
+
self.replied_on = attributes[:'RepliedOn']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'ParentReplyGuid')
|
114
|
+
self.parent_reply_guid = attributes[:'ParentReplyGuid']
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properies with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = []
|
123
|
+
if @replied_on.nil?
|
124
|
+
invalid_properties.push("invalid value for 'replied_on', replied_on cannot be nil.")
|
125
|
+
end
|
126
|
+
|
127
|
+
return invalid_properties
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check to see if the all the properties in the model are valid
|
131
|
+
# @return true if the model is valid
|
132
|
+
def valid?
|
133
|
+
return false if @replied_on.nil?
|
134
|
+
return true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(other)
|
140
|
+
return true if self.equal?(other)
|
141
|
+
self.class == other.class &&
|
142
|
+
guid == other.guid &&
|
143
|
+
user_guid == other.user_guid &&
|
144
|
+
user_name == other.user_name &&
|
145
|
+
user_email == other.user_email &&
|
146
|
+
message == other.message &&
|
147
|
+
replied_on == other.replied_on &&
|
148
|
+
parent_reply_guid == other.parent_reply_guid
|
149
|
+
end
|
150
|
+
|
151
|
+
# @see the `==` method
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def eql?(other)
|
154
|
+
self == other
|
155
|
+
end
|
156
|
+
|
157
|
+
# Calculates hash code according to all attributes.
|
158
|
+
# @return [Fixnum] Hash code
|
159
|
+
def hash
|
160
|
+
[guid, user_guid, user_name, user_email, message, replied_on, parent_reply_guid].hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
self.class.swagger_types.each_pair do |key, type|
|
169
|
+
if type =~ /\AArray<(.*)>/i
|
170
|
+
# check to ensure the input is an array given that the the attribute
|
171
|
+
# is documented as an array but the input is not
|
172
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
173
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
174
|
+
end
|
175
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
176
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
177
|
+
end
|
178
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
179
|
+
end
|
180
|
+
|
181
|
+
self
|
182
|
+
end
|
183
|
+
|
184
|
+
# Deserializes the data based on type
|
185
|
+
# @param string type Data type
|
186
|
+
# @param string value Value to be deserialized
|
187
|
+
# @return [Object] Deserialized data
|
188
|
+
def _deserialize(type, value)
|
189
|
+
case type.to_sym
|
190
|
+
when :DateTime
|
191
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
192
|
+
when :Date
|
193
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
194
|
+
when :String
|
195
|
+
value.to_s
|
196
|
+
when :Integer
|
197
|
+
value.to_i
|
198
|
+
when :Float
|
199
|
+
value.to_f
|
200
|
+
when :BOOLEAN
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
when :Object
|
207
|
+
# generic object (usually a Hash), return directly
|
208
|
+
value
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each do |k, v|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
else
|
221
|
+
# model
|
222
|
+
temp_model = GroupDocsAnnotationCloud.const_get(type).new
|
223
|
+
temp_model.build_from_hash(value)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the string representation of the object
|
228
|
+
# @return [String] String presentation of the object
|
229
|
+
def to_s
|
230
|
+
to_hash.to_s
|
231
|
+
end
|
232
|
+
|
233
|
+
# to_body is an alias to to_hash (backward compatibility)
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_body
|
236
|
+
to_hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns the object in the form of hash
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
241
|
+
def to_hash
|
242
|
+
hash = {}
|
243
|
+
self.class.attribute_map.each_pair do |attr, param|
|
244
|
+
value = self.send(attr)
|
245
|
+
next if value.nil?
|
246
|
+
hash[param] = _to_hash(value)
|
247
|
+
end
|
248
|
+
hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Outputs non-array value in the form of hash
|
252
|
+
# For object, use to_hash. Otherwise, just return the value
|
253
|
+
# @param [Object] value Any valid value
|
254
|
+
# @return [Hash] Returns the value in the form of hash
|
255
|
+
def _to_hash(value)
|
256
|
+
if value.is_a?(Array)
|
257
|
+
value.compact.map { |v| _to_hash(v) }
|
258
|
+
elsif value.is_a?(Hash)
|
259
|
+
{}.tap do |hash|
|
260
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
261
|
+
end
|
262
|
+
elsif value.respond_to? :to_hash
|
263
|
+
value.to_hash
|
264
|
+
else
|
265
|
+
value
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="document_info.rb">
|
4
|
+
# Copyright (c) 2003-2018 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsAnnotationCloud
|
31
|
+
|
32
|
+
class DocumentInfo
|
33
|
+
attr_accessor :name
|
34
|
+
attr_accessor :folder
|
35
|
+
attr_accessor :extension
|
36
|
+
attr_accessor :file_format
|
37
|
+
attr_accessor :size
|
38
|
+
attr_accessor :date_modified
|
39
|
+
attr_accessor :pages
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
:'name' => :'name',
|
45
|
+
:'folder' => :'folder',
|
46
|
+
:'extension' => :'extension',
|
47
|
+
:'file_format' => :'fileFormat',
|
48
|
+
:'size' => :'size',
|
49
|
+
:'date_modified' => :'dateModified',
|
50
|
+
:'pages' => :'pages'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.swagger_types
|
56
|
+
{
|
57
|
+
:'name' => :'String',
|
58
|
+
:'folder' => :'String',
|
59
|
+
:'extension' => :'String',
|
60
|
+
:'file_format' => :'String',
|
61
|
+
:'size' => :'Integer',
|
62
|
+
:'date_modified' => :'DateTime',
|
63
|
+
:'pages' => :'Array<PageInfo>'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes the object
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
def initialize(attributes = {})
|
70
|
+
return unless attributes.is_a?(Hash)
|
71
|
+
|
72
|
+
# convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
74
|
+
|
75
|
+
if attributes.key?(:'Name')
|
76
|
+
self.name = attributes[:'Name']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'Folder')
|
80
|
+
self.folder = attributes[:'Folder']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'Extension')
|
84
|
+
self.extension = attributes[:'Extension']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'FileFormat')
|
88
|
+
self.file_format = attributes[:'FileFormat']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'Size')
|
92
|
+
self.size = attributes[:'Size']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'DateModified')
|
96
|
+
self.date_modified = attributes[:'DateModified']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'Pages')
|
100
|
+
if (value = attributes[:'Pages']).is_a?(Array)
|
101
|
+
self.pages = value
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
108
|
+
# @return Array for valid properies with the reasons
|
109
|
+
def list_invalid_properties
|
110
|
+
invalid_properties = []
|
111
|
+
if @size.nil?
|
112
|
+
invalid_properties.push("invalid value for 'size', size cannot be nil.")
|
113
|
+
end
|
114
|
+
|
115
|
+
if @date_modified.nil?
|
116
|
+
invalid_properties.push("invalid value for 'date_modified', date_modified cannot be nil.")
|
117
|
+
end
|
118
|
+
|
119
|
+
return invalid_properties
|
120
|
+
end
|
121
|
+
|
122
|
+
# Check to see if the all the properties in the model are valid
|
123
|
+
# @return true if the model is valid
|
124
|
+
def valid?
|
125
|
+
return false if @size.nil?
|
126
|
+
return false if @date_modified.nil?
|
127
|
+
return true
|
128
|
+
end
|
129
|
+
|
130
|
+
# Checks equality by comparing each attribute.
|
131
|
+
# @param [Object] Object to be compared
|
132
|
+
def ==(other)
|
133
|
+
return true if self.equal?(other)
|
134
|
+
self.class == other.class &&
|
135
|
+
name == other.name &&
|
136
|
+
folder == other.folder &&
|
137
|
+
extension == other.extension &&
|
138
|
+
file_format == other.file_format &&
|
139
|
+
size == other.size &&
|
140
|
+
date_modified == other.date_modified &&
|
141
|
+
pages == other.pages
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def eql?(other)
|
147
|
+
self == other
|
148
|
+
end
|
149
|
+
|
150
|
+
# Calculates hash code according to all attributes.
|
151
|
+
# @return [Fixnum] Hash code
|
152
|
+
def hash
|
153
|
+
[name, folder, extension, file_format, size, date_modified, pages].hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def build_from_hash(attributes)
|
160
|
+
return nil unless attributes.is_a?(Hash)
|
161
|
+
self.class.swagger_types.each_pair do |key, type|
|
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 attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
167
|
+
end
|
168
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
169
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
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
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
185
|
+
when :Date
|
186
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
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 = GroupDocsAnnotationCloud.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
|