groupdocs_annotation_cloud 18.7 → 19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_annotation_cloud.rb +23 -39
  3. data/lib/groupdocs_annotation_cloud/api/annotate_api.rb +664 -0
  4. data/lib/groupdocs_annotation_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_annotation_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_annotation_cloud/api/{pdf_file_api.rb → info_api.rb} +101 -105
  7. data/lib/groupdocs_annotation_cloud/api/preview_api.rb +380 -0
  8. data/lib/groupdocs_annotation_cloud/api/storage_api.rb +541 -0
  9. data/lib/groupdocs_annotation_cloud/api_client.rb +7 -17
  10. data/lib/groupdocs_annotation_cloud/api_error.rb +5 -3
  11. data/lib/groupdocs_annotation_cloud/configuration.rb +3 -3
  12. data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +24 -16
  13. data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +97 -82
  14. data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +31 -23
  15. data/lib/groupdocs_annotation_cloud/models/disc_usage.rb +234 -0
  16. data/lib/groupdocs_annotation_cloud/models/document_info.rb +44 -22
  17. data/lib/groupdocs_annotation_cloud/models/error.rb +244 -0
  18. data/lib/groupdocs_annotation_cloud/models/error_details.rb +229 -0
  19. data/lib/groupdocs_annotation_cloud/models/file_version.rb +289 -0
  20. data/lib/groupdocs_annotation_cloud/models/{value_type.rb → file_versions.rb} +33 -13
  21. data/lib/groupdocs_annotation_cloud/models/files_list.rb +216 -0
  22. data/lib/groupdocs_annotation_cloud/models/files_upload_result.rb +228 -0
  23. data/lib/groupdocs_annotation_cloud/models/format.rb +224 -0
  24. data/lib/groupdocs_annotation_cloud/models/formats_result.rb +216 -0
  25. data/lib/groupdocs_annotation_cloud/models/link.rb +24 -16
  26. data/lib/groupdocs_annotation_cloud/models/link_element.rb +18 -10
  27. data/lib/groupdocs_annotation_cloud/models/object_exist.rb +234 -0
  28. data/lib/groupdocs_annotation_cloud/models/{image_page.rb → page_image.rb} +28 -13
  29. data/lib/groupdocs_annotation_cloud/models/{image_pages.rb → page_images.rb} +26 -14
  30. data/lib/groupdocs_annotation_cloud/models/page_info.rb +41 -23
  31. data/lib/groupdocs_annotation_cloud/models/point.rb +31 -13
  32. data/lib/groupdocs_annotation_cloud/models/rectangle.rb +45 -17
  33. data/lib/groupdocs_annotation_cloud/models/row_info.rb +38 -16
  34. data/lib/groupdocs_annotation_cloud/models/storage_exist.rb +219 -0
  35. data/lib/groupdocs_annotation_cloud/models/storage_file.rb +264 -0
  36. data/lib/groupdocs_annotation_cloud/version.rb +2 -2
  37. metadata +22 -39
  38. data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +0 -344
  39. data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +0 -218
  40. data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +0 -395
  41. data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +0 -53
  42. data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +0 -49
  43. data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +0 -53
  44. data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +0 -53
  45. data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +0 -53
  46. data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +0 -49
  47. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +0 -53
  48. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +0 -53
  49. data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +0 -53
  50. data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +0 -57
@@ -0,0 +1,216 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="formats_result.rb">
4
+ # Copyright (c) 2003-2019 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
+ # Describes object which contains list of supported file formats
32
+ class FormatsResult
33
+
34
+ # Supported file formats
35
+ attr_accessor :formats
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'formats' => :'Formats'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'formats' => :'Array<Format>'
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?(:'Formats')
60
+ if (value = attributes[:'Formats']).is_a?(Array)
61
+ self.formats = value
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properies with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = []
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(other)
83
+ return true if self.equal?(other)
84
+ self.class == other.class &&
85
+ formats == other.formats
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(other)
91
+ self == other
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [formats].hash
98
+ end
99
+
100
+ # Downcases first letter.
101
+ # @return downcased string
102
+ def uncap(str)
103
+ str[0, 1].downcase + str[1..-1]
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.swagger_types.each_pair do |key, type|
112
+ pname = uncap(self.class.attribute_map[key]).intern
113
+ value = attributes[pname]
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the the attribute
116
+ # is documented as an array but the input is not
117
+ if value.is_a?(Array)
118
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !value.nil?
121
+ self.send("#{key}=", _deserialize(type, value))
122
+ end
123
+ # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ Date.parse value
137
+ when :Date
138
+ Date.parse value
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else
166
+ # model
167
+ temp_model = GroupDocsAnnotationCloud.const_get(type).new
168
+ temp_model.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+
216
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="link.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -28,28 +28,28 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsAnnotationCloud
31
- # Provides information for the object link. This is supposed to be an atom:link, therefore it should have all attributes specified here http://tools.ietf.org/html/rfc4287#section-4.2.7
31
+ # Provides information for the object link This is supposed to be an atom:link, therefore it should have all attributes specified here http://tools.ietf.org/html/rfc4287#section-4.2.7
32
32
  class Link
33
33
 
34
34
  # The \"href\" attribute contains the link's IRI. atom:link elements MUST have an href attribute, whose value MUST be a IRI reference
35
35
  attr_accessor :href
36
36
 
37
- # atom:link elements MAY have a \"rel\" attribute that indicates the link relation type. If the \"rel\" attribute is not present, the link element MUST be interpreted as if the link relation type is \"alternate\".
37
+ # atom:link elements MAY have a \"rel\" attribute that indicates the link relation type. If the \"rel\" attribute is not present, the link element MUST be interpreted as if the link relation type is \"alternate\"
38
38
  attr_accessor :rel
39
39
 
40
- # On the link element, the \"type\" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note that the type attribute does not override the actual media type returned with the representation.
40
+ # On the link element, the \"type\" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note that the type attribute does not override the actual media type returned with the representation
41
41
  attr_accessor :type
42
42
 
43
- # The \"title\" attribute conveys human-readable information about the link. The content of the \"title\" attribute is Language-Sensitive.
43
+ # The \"title\" attribute conveys human-readable information about the link. The content of the \"title\" attribute is Language-Sensitive
44
44
  attr_accessor :title
45
45
 
46
46
  # Attribute mapping from ruby-style variable name to JSON key.
47
47
  def self.attribute_map
48
48
  {
49
- :'href' => :'href',
50
- :'rel' => :'rel',
51
- :'type' => :'type',
52
- :'title' => :'title'
49
+ :'href' => :'Href',
50
+ :'rel' => :'Rel',
51
+ :'type' => :'Type',
52
+ :'title' => :'Title'
53
53
  }
54
54
  end
55
55
 
@@ -125,20 +125,28 @@ module GroupDocsAnnotationCloud
125
125
  [href, rel, type, title].hash
126
126
  end
127
127
 
128
+ # Downcases first letter.
129
+ # @return downcased string
130
+ def uncap(str)
131
+ str[0, 1].downcase + str[1..-1]
132
+ end
133
+
128
134
  # Builds the object from hash
129
135
  # @param [Hash] attributes Model attributes in the form of hash
130
136
  # @return [Object] Returns the model itself
131
137
  def build_from_hash(attributes)
132
138
  return nil unless attributes.is_a?(Hash)
133
139
  self.class.swagger_types.each_pair do |key, type|
140
+ pname = uncap(self.class.attribute_map[key]).intern
141
+ value = attributes[pname]
134
142
  if type =~ /\AArray<(.*)>/i
135
143
  # check to ensure the input is an array given that the the attribute
136
- # is documented as an array but the input is not
137
- if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ # is documented as an array but the input is not
145
+ if value.is_a?(Array)
146
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
139
147
  end
140
- elsif !attributes[self.class.attribute_map[key]].nil?
141
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ elsif !value.nil?
149
+ self.send("#{key}=", _deserialize(type, value))
142
150
  end
143
151
  # or else data not found in attributes(hash), not an issue as the data can be optional
144
152
  end
@@ -153,9 +161,9 @@ module GroupDocsAnnotationCloud
153
161
  def _deserialize(type, value)
154
162
  case type.to_sym
155
163
  when :DateTime
156
- Time.at(/\d/.match(value)[0].to_f).to_datetime
164
+ Date.parse value
157
165
  when :Date
158
- Time.at(/\d/.match(value)[0].to_f).to_date
166
+ Date.parse value
159
167
  when :String
160
168
  value.to_s
161
169
  when :Integer
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="link_element.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -28,10 +28,10 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsAnnotationCloud
31
- # Reference to document.
31
+ # Reference to document
32
32
  class LinkElement
33
33
 
34
- # Link to the document.
34
+ # Link to the document
35
35
  attr_accessor :link
36
36
 
37
37
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -95,20 +95,28 @@ module GroupDocsAnnotationCloud
95
95
  [link].hash
96
96
  end
97
97
 
98
+ # Downcases first letter.
99
+ # @return downcased string
100
+ def uncap(str)
101
+ str[0, 1].downcase + str[1..-1]
102
+ end
103
+
98
104
  # Builds the object from hash
99
105
  # @param [Hash] attributes Model attributes in the form of hash
100
106
  # @return [Object] Returns the model itself
101
107
  def build_from_hash(attributes)
102
108
  return nil unless attributes.is_a?(Hash)
103
109
  self.class.swagger_types.each_pair do |key, type|
110
+ pname = uncap(self.class.attribute_map[key]).intern
111
+ value = attributes[pname]
104
112
  if type =~ /\AArray<(.*)>/i
105
113
  # check to ensure the input is an array given that the the attribute
106
- # is documented as an array but the input is not
107
- if attributes[self.class.attribute_map[key]].is_a?(Array)
108
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ # is documented as an array but the input is not
115
+ if value.is_a?(Array)
116
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
109
117
  end
110
- elsif !attributes[self.class.attribute_map[key]].nil?
111
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ elsif !value.nil?
119
+ self.send("#{key}=", _deserialize(type, value))
112
120
  end
113
121
  # or else data not found in attributes(hash), not an issue as the data can be optional
114
122
  end
@@ -123,9 +131,9 @@ module GroupDocsAnnotationCloud
123
131
  def _deserialize(type, value)
124
132
  case type.to_sym
125
133
  when :DateTime
126
- Time.at(/\d/.match(value)[0].to_f).to_datetime
134
+ Date.parse value
127
135
  when :Date
128
- Time.at(/\d/.match(value)[0].to_f).to_date
136
+ Date.parse value
129
137
  when :String
130
138
  value.to_s
131
139
  when :Integer
@@ -0,0 +1,234 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="object_exist.rb">
4
+ # Copyright (c) 2003-2019 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
+ # Object exists
32
+ class ObjectExist
33
+
34
+ # Indicates that the file or folder exists.
35
+ attr_accessor :exists
36
+
37
+ # True if it is a folder, false if it is a file.
38
+ attr_accessor :is_folder
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'exists' => :'Exists',
44
+ :'is_folder' => :'IsFolder'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'exists' => :'BOOLEAN',
52
+ :'is_folder' => :'BOOLEAN'
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?(:'Exists')
65
+ self.exists = attributes[:'Exists']
66
+ end
67
+
68
+ if attributes.key?(:'IsFolder')
69
+ self.is_folder = attributes[:'IsFolder']
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 @exists.nil?
79
+ invalid_properties.push("invalid value for 'exists', exists cannot be nil.")
80
+ end
81
+
82
+ if @is_folder.nil?
83
+ invalid_properties.push("invalid value for 'is_folder', is_folder 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 @exists.nil?
93
+ return false if @is_folder.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
+ exists == other.exists &&
103
+ is_folder == other.is_folder
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
+ [exists, is_folder].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 = GroupDocsAnnotationCloud.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