AsposeDiagramCloud 18.10 → 20.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/AsposeDiagramCloud.gemspec +46 -0
  3. data/Gemfile +7 -0
  4. data/README.md +74 -0
  5. data/Rakefile +8 -0
  6. data/git_push.sh +55 -0
  7. data/lib/AsposeDiagramCloud.rb +85 -0
  8. data/lib/AsposeDiagramCloud/api/diagram_api.rb +768 -0
  9. data/lib/AsposeDiagramCloud/api/o_auth_api.rb +93 -0
  10. data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
  11. data/lib/AsposeDiagramCloud/api_client.rb +391 -0
  12. data/lib/AsposeDiagramCloud/api_error.rb +38 -0
  13. data/lib/AsposeDiagramCloud/configuration.rb +209 -0
  14. data/lib/AsposeDiagramCloud/models/access_token_response.rb +251 -0
  15. data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
  16. data/lib/AsposeDiagramCloud/models/create_new_response.rb +188 -0
  17. data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
  18. data/lib/AsposeDiagramCloud/models/disc_usage.rb +209 -0
  19. data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
  20. data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
  21. data/lib/AsposeDiagramCloud/models/error.rb +219 -0
  22. data/lib/AsposeDiagramCloud/models/error_details.rb +204 -0
  23. data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
  24. data/lib/AsposeDiagramCloud/models/file_versions.rb +191 -0
  25. data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
  26. data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
  27. data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
  28. data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
  29. data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
  30. data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
  31. data/lib/AsposeDiagramCloud/models/object_exist.rb +209 -0
  32. data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
  33. data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
  34. data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
  35. data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
  36. data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
  37. data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
  38. data/lib/AsposeDiagramCloud/models/point_f.rb +221 -0
  39. data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
  40. data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
  41. data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
  42. data/lib/AsposeDiagramCloud/models/saa_spose_response.rb +179 -0
  43. data/lib/AsposeDiagramCloud/models/save_as_response.rb +208 -0
  44. data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
  45. data/lib/AsposeDiagramCloud/models/save_options_request.rb +206 -0
  46. data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
  47. data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
  48. data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
  49. data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
  50. data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
  51. data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
  52. data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
  53. data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
  54. data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
  55. data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
  56. data/lib/AsposeDiagramCloud/version.rb +15 -0
  57. data/spec/_spec.rb +308 -0
  58. data/spec/api/test_convert_spec.rb +308 -0
  59. data/spec/api/test_drawing_spec.rb +136 -0
  60. data/spec/api/test_page_spec.rb +92 -0
  61. data/spec/api_client_spec.rb +226 -0
  62. data/spec/configuration_spec.rb +42 -0
  63. data/spec/spec_helper.rb +120 -0
  64. data/testData/FileUpload.vdx +437 -0
  65. metadata +118 -49
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Aspose.Diagram Cloud API Reference
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 3.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AsposeDiagramCloud
16
+ # Error
17
+ class Error
18
+ # Code
19
+ attr_accessor :code
20
+
21
+ # Message
22
+ attr_accessor :message
23
+
24
+ # Description
25
+ attr_accessor :description
26
+
27
+ # Inner Error
28
+ attr_accessor :inner_error
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'code' => :'Code',
35
+ :'message' => :'Message',
36
+ :'description' => :'Description',
37
+ :'inner_error' => :'InnerError'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'code' => :'String',
45
+ :'message' => :'String',
46
+ :'description' => :'String',
47
+ :'inner_error' => :'ErrorDetails'
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.has_key?(:'Code')
60
+ self.code = attributes[:'Code']
61
+ end
62
+
63
+ if attributes.has_key?(:'Message')
64
+ self.message = attributes[:'Message']
65
+ end
66
+
67
+ if attributes.has_key?(:'Description')
68
+ self.description = attributes[:'Description']
69
+ end
70
+
71
+ if attributes.has_key?(:'InnerError')
72
+ self.inner_error = attributes[:'InnerError']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properies with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ return invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ code == o.code &&
96
+ message == o.message &&
97
+ description == o.description &&
98
+ inner_error == o.inner_error
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [code, message, description, inner_error].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = AsposeDiagramCloud.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map{ |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,204 @@
1
+ =begin
2
+ #Aspose.Diagram Cloud API Reference
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 3.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AsposeDiagramCloud
16
+ # The error details
17
+ class ErrorDetails
18
+ # The request id
19
+ attr_accessor :request_id
20
+
21
+ # Date
22
+ attr_accessor :date
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'request_id' => :'RequestId',
29
+ :'date' => :'Date'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'request_id' => :'String',
37
+ :'date' => :'DateTime'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'RequestId')
50
+ self.request_id = attributes[:'RequestId']
51
+ end
52
+
53
+ if attributes.has_key?(:'Date')
54
+ self.date = attributes[:'Date']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properies with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @date.nil?
64
+ invalid_properties.push("invalid value for 'date', date cannot be nil.")
65
+ end
66
+
67
+ return invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @date.nil?
74
+ return true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ request_id == o.request_id &&
83
+ date == o.date
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [request_id, date].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.swagger_types.each_pair do |key, type|
104
+ if type =~ /\AArray<(.*)>/i
105
+ # 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) } )
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :BOOLEAN
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ temp_model = AsposeDiagramCloud.const_get(type).new
156
+ temp_model.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map{ |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ end
@@ -0,0 +1,264 @@
1
+ =begin
2
+ #Aspose.Diagram Cloud API Reference
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 3.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AsposeDiagramCloud
16
+ # File Version
17
+ class FileVersion
18
+ # File or folder name.
19
+ attr_accessor :name
20
+
21
+ # True if it is a folder.
22
+ attr_accessor :is_folder
23
+
24
+ # File or folder last modified DateTime.
25
+ attr_accessor :modified_date
26
+
27
+ # File or folder size.
28
+ attr_accessor :size
29
+
30
+ # File or folder path.
31
+ attr_accessor :path
32
+
33
+ # File Version ID.
34
+ attr_accessor :version_id
35
+
36
+ # Specifies whether the file is (true) or is not (false) the latest version of an file.
37
+ attr_accessor :is_latest
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'name' => :'Name',
44
+ :'is_folder' => :'IsFolder',
45
+ :'modified_date' => :'ModifiedDate',
46
+ :'size' => :'Size',
47
+ :'path' => :'Path',
48
+ :'version_id' => :'VersionId',
49
+ :'is_latest' => :'IsLatest'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'name' => :'String',
57
+ :'is_folder' => :'BOOLEAN',
58
+ :'modified_date' => :'DateTime',
59
+ :'size' => :'Integer',
60
+ :'path' => :'String',
61
+ :'version_id' => :'String',
62
+ :'is_latest' => :'BOOLEAN'
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.has_key?(:'Name')
75
+ self.name = attributes[:'Name']
76
+ end
77
+
78
+ if attributes.has_key?(:'IsFolder')
79
+ self.is_folder = attributes[:'IsFolder']
80
+ end
81
+
82
+ if attributes.has_key?(:'ModifiedDate')
83
+ self.modified_date = attributes[:'ModifiedDate']
84
+ end
85
+
86
+ if attributes.has_key?(:'Size')
87
+ self.size = attributes[:'Size']
88
+ end
89
+
90
+ if attributes.has_key?(:'Path')
91
+ self.path = attributes[:'Path']
92
+ end
93
+
94
+ if attributes.has_key?(:'VersionId')
95
+ self.version_id = attributes[:'VersionId']
96
+ end
97
+
98
+ if attributes.has_key?(:'IsLatest')
99
+ self.is_latest = attributes[:'IsLatest']
100
+ end
101
+
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properies with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @is_folder.nil?
109
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
110
+ end
111
+
112
+ if @size.nil?
113
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
114
+ end
115
+
116
+ if @is_latest.nil?
117
+ invalid_properties.push("invalid value for 'is_latest', is_latest cannot be nil.")
118
+ end
119
+
120
+ return invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ return false if @is_folder.nil?
127
+ return false if @size.nil?
128
+ return false if @is_latest.nil?
129
+ return true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ name == o.name &&
138
+ is_folder == o.is_folder &&
139
+ modified_date == o.modified_date &&
140
+ size == o.size &&
141
+ path == o.path &&
142
+ version_id == o.version_id &&
143
+ is_latest == o.is_latest
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Fixnum] Hash code
154
+ def hash
155
+ [name, is_folder, modified_date, size, path, version_id, is_latest].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.swagger_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
173
+ end
174
+
175
+ self
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def _deserialize(type, value)
183
+ case type.to_sym
184
+ when :DateTime
185
+ DateTime.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :BOOLEAN
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ temp_model = AsposeDiagramCloud.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