aspose_diagram_cloud 19.10 → 20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -94
  3. data/lib/AsposeDiagramCloud.rb +11 -0
  4. data/lib/AsposeDiagramCloud/api/diagram_api.rb +468 -0
  5. data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
  6. data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
  7. data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
  8. data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
  9. data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
  10. data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
  11. data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
  12. data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
  13. data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
  14. data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
  15. data/lib/AsposeDiagramCloud/version.rb +1 -1
  16. data/spec/_spec.rb +308 -0
  17. data/spec/api/test_drawing_spec.rb +136 -0
  18. data/spec/api/test_page_spec.rb +92 -0
  19. metadata +18 -37
  20. data/docs/AccessTokenResponse.md +0 -15
  21. data/docs/CreateNewResponse.md +0 -8
  22. data/docs/DiagramApi.md +0 -241
  23. data/docs/DiagramSaveOptions.md +0 -10
  24. data/docs/DiscUsage.md +0 -9
  25. data/docs/Error.md +0 -11
  26. data/docs/ErrorDetails.md +0 -9
  27. data/docs/FileVersion.md +0 -14
  28. data/docs/FileVersions.md +0 -8
  29. data/docs/FilesList.md +0 -8
  30. data/docs/FilesUploadResult.md +0 -9
  31. data/docs/HTMLSaveOptions.md +0 -19
  32. data/docs/ImageSaveOptions.md +0 -29
  33. data/docs/ModifyResponse.md +0 -9
  34. data/docs/OAuthApi.md +0 -60
  35. data/docs/ObjectExist.md +0 -9
  36. data/docs/PageSize.md +0 -8
  37. data/docs/PdfDigitalSignatureDetails.md +0 -11
  38. data/docs/PdfEncryptionDetails.md +0 -11
  39. data/docs/PdfSaveOptions.md +0 -25
  40. data/docs/PointF.md +0 -10
  41. data/docs/RectangleF.md +0 -18
  42. data/docs/RenderingSaveOptions.md +0 -13
  43. data/docs/SVGSaveOptions.md +0 -18
  44. data/docs/SWFSaveOptions.md +0 -13
  45. data/docs/SaaSposeResponse.md +0 -7
  46. data/docs/SaveAsResponse.md +0 -10
  47. data/docs/SaveOptionsModel.md +0 -9
  48. data/docs/SaveOptionsRequest.md +0 -10
  49. data/docs/StorageApi.md +0 -799
  50. data/docs/StorageExist.md +0 -8
  51. data/docs/StorageFile.md +0 -12
  52. data/docs/UploadResponse.md +0 -8
  53. data/docs/XAMLSaveOptions.md +0 -12
  54. data/docs/XPSSaveOptions.md +0 -13
@@ -0,0 +1,216 @@
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
+
17
+ class PageData
18
+ # Page Id
19
+ attr_accessor :id
20
+
21
+ # page setting info
22
+ attr_accessor :page_setting
23
+
24
+ # shape list
25
+ attr_accessor :shapes
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'ID',
32
+ :'page_setting' => :'PageSetting',
33
+ :'shapes' => :'Shapes'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'id' => :'Integer',
41
+ :'page_setting' => :'PageSetting',
42
+ :'shapes' => :'Array<ShapeData>'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'ID')
55
+ self.id = attributes[:'ID']
56
+ end
57
+
58
+ if attributes.has_key?(:'PageSetting')
59
+ self.page_setting = attributes[:'PageSetting']
60
+ end
61
+
62
+ if attributes.has_key?(:'Shapes')
63
+ if (value = attributes[:'Shapes']).is_a?(Array)
64
+ self.shapes = value
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properies with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @id.nil?
75
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
76
+ end
77
+
78
+ return invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ return false if @id.nil?
85
+ return true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ id == o.id &&
94
+ page_setting == o.page_setting &&
95
+ shapes == o.shapes
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [id, page_setting, shapes].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :BOOLEAN
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ temp_model = AsposeDiagramCloud.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
@@ -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
+ # page setting info
17
+ class PageSetting
18
+ # Page Name
19
+ attr_accessor :name
20
+
21
+ # Page Name
22
+ attr_accessor :name_u
23
+
24
+ # Page Width
25
+ attr_accessor :page_width
26
+
27
+ # Page Height
28
+ attr_accessor :page_height
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'name' => :'Name',
35
+ :'name_u' => :'NameU',
36
+ :'page_width' => :'PageWidth',
37
+ :'page_height' => :'PageHeight'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'name' => :'String',
45
+ :'name_u' => :'String',
46
+ :'page_width' => :'Float',
47
+ :'page_height' => :'Float'
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?(:'Name')
60
+ self.name = attributes[:'Name']
61
+ end
62
+
63
+ if attributes.has_key?(:'NameU')
64
+ self.name_u = attributes[:'NameU']
65
+ end
66
+
67
+ if attributes.has_key?(:'PageWidth')
68
+ self.page_width = attributes[:'PageWidth']
69
+ end
70
+
71
+ if attributes.has_key?(:'PageHeight')
72
+ self.page_height = attributes[:'PageHeight']
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
+ name == o.name &&
96
+ name_u == o.name_u &&
97
+ page_width == o.page_width &&
98
+ page_height == o.page_height
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
+ [name, name_u, page_width, page_height].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,273 @@
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
+
17
+ class PolylineData
18
+ attr_accessor :pin_x
19
+
20
+ attr_accessor :pin_y
21
+
22
+ attr_accessor :width
23
+
24
+ attr_accessor :height
25
+
26
+ attr_accessor :shape_style_data
27
+
28
+ attr_accessor :text
29
+
30
+ attr_accessor :text_style_data
31
+
32
+ attr_accessor :points
33
+
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'pin_x' => :'PinX',
39
+ :'pin_y' => :'PinY',
40
+ :'width' => :'Width',
41
+ :'height' => :'Height',
42
+ :'shape_style_data' => :'ShapeStyleData',
43
+ :'text' => :'Text',
44
+ :'text_style_data' => :'TextStyleData',
45
+ :'points' => :'Points'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'pin_x' => :'Float',
53
+ :'pin_y' => :'Float',
54
+ :'width' => :'Float',
55
+ :'height' => :'Float',
56
+ :'shape_style_data' => :'ShapeStyleData',
57
+ :'text' => :'String',
58
+ :'text_style_data' => :'TextStyleData',
59
+ :'points' => :'Array<PointF>'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
70
+
71
+ if attributes.has_key?(:'PinX')
72
+ self.pin_x = attributes[:'PinX']
73
+ end
74
+
75
+ if attributes.has_key?(:'PinY')
76
+ self.pin_y = attributes[:'PinY']
77
+ end
78
+
79
+ if attributes.has_key?(:'Width')
80
+ self.width = attributes[:'Width']
81
+ end
82
+
83
+ if attributes.has_key?(:'Height')
84
+ self.height = attributes[:'Height']
85
+ end
86
+
87
+ if attributes.has_key?(:'ShapeStyleData')
88
+ self.shape_style_data = attributes[:'ShapeStyleData']
89
+ end
90
+
91
+ if attributes.has_key?(:'Text')
92
+ self.text = attributes[:'Text']
93
+ end
94
+
95
+ if attributes.has_key?(:'TextStyleData')
96
+ self.text_style_data = attributes[:'TextStyleData']
97
+ end
98
+
99
+ if attributes.has_key?(:'Points')
100
+ if (value = attributes[:'Points']).is_a?(Array)
101
+ self.points = 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 = Array.new
111
+ if @pin_x.nil?
112
+ invalid_properties.push("invalid value for 'pin_x', pin_x cannot be nil.")
113
+ end
114
+
115
+ if @pin_y.nil?
116
+ invalid_properties.push("invalid value for 'pin_y', pin_y cannot be nil.")
117
+ end
118
+
119
+ if @width.nil?
120
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
121
+ end
122
+
123
+ if @height.nil?
124
+ invalid_properties.push("invalid value for 'height', height 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 @pin_x.nil?
134
+ return false if @pin_y.nil?
135
+ return false if @width.nil?
136
+ return false if @height.nil?
137
+ return true
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ pin_x == o.pin_x &&
146
+ pin_y == o.pin_y &&
147
+ width == o.width &&
148
+ height == o.height &&
149
+ shape_style_data == o.shape_style_data &&
150
+ text == o.text &&
151
+ text_style_data == o.text_style_data &&
152
+ points == o.points
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(o)
158
+ self == o
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Fixnum] Hash code
163
+ def hash
164
+ [pin_x, pin_y, width, height, shape_style_data, text, text_style_data, points].hash
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ self.class.swagger_types.each_pair do |key, type|
173
+ if type =~ /\AArray<(.*)>/i
174
+ # check to ensure the input is an array given that the the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
177
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
178
+ end
179
+ elsif !attributes[self.class.attribute_map[key]].nil?
180
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
181
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
182
+ end
183
+
184
+ self
185
+ end
186
+
187
+ # Deserializes the data based on type
188
+ # @param string type Data type
189
+ # @param string value Value to be deserialized
190
+ # @return [Object] Deserialized data
191
+ def _deserialize(type, value)
192
+ case type.to_sym
193
+ when :DateTime
194
+ DateTime.parse(value)
195
+ when :Date
196
+ Date.parse(value)
197
+ when :String
198
+ value.to_s
199
+ when :Integer
200
+ value.to_i
201
+ when :Float
202
+ value.to_f
203
+ when :BOOLEAN
204
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
205
+ true
206
+ else
207
+ false
208
+ end
209
+ when :Object
210
+ # generic object (usually a Hash), return directly
211
+ value
212
+ when /\AArray<(?<inner_type>.+)>\z/
213
+ inner_type = Regexp.last_match[:inner_type]
214
+ value.map { |v| _deserialize(inner_type, v) }
215
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
216
+ k_type = Regexp.last_match[:k_type]
217
+ v_type = Regexp.last_match[:v_type]
218
+ {}.tap do |hash|
219
+ value.each do |k, v|
220
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
221
+ end
222
+ end
223
+ else # model
224
+ temp_model = AsposeDiagramCloud.const_get(type).new
225
+ temp_model.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ next if value.nil?
248
+ hash[param] = _to_hash(value)
249
+ end
250
+ hash
251
+ end
252
+
253
+ # Outputs non-array value in the form of hash
254
+ # For object, use to_hash. Otherwise, just return the value
255
+ # @param [Object] value Any valid value
256
+ # @return [Hash] Returns the value in the form of hash
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map{ |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+
271
+ end
272
+
273
+ end