AsposeDiagramCloud 18.10 → 20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/AsposeDiagramCloud.gemspec +46 -0
- data/Gemfile +7 -0
- data/README.md +74 -0
- data/Rakefile +8 -0
- data/git_push.sh +55 -0
- data/lib/AsposeDiagramCloud.rb +85 -0
- data/lib/AsposeDiagramCloud/api/diagram_api.rb +768 -0
- data/lib/AsposeDiagramCloud/api/o_auth_api.rb +93 -0
- data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
- data/lib/AsposeDiagramCloud/api_client.rb +391 -0
- data/lib/AsposeDiagramCloud/api_error.rb +38 -0
- data/lib/AsposeDiagramCloud/configuration.rb +209 -0
- data/lib/AsposeDiagramCloud/models/access_token_response.rb +251 -0
- data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
- data/lib/AsposeDiagramCloud/models/create_new_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
- data/lib/AsposeDiagramCloud/models/disc_usage.rb +209 -0
- data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/error.rb +219 -0
- data/lib/AsposeDiagramCloud/models/error_details.rb +204 -0
- data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
- data/lib/AsposeDiagramCloud/models/file_versions.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
- data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
- data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
- data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
- data/lib/AsposeDiagramCloud/models/object_exist.rb +209 -0
- data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
- data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
- data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
- data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
- data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
- data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
- data/lib/AsposeDiagramCloud/models/point_f.rb +221 -0
- data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
- data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
- data/lib/AsposeDiagramCloud/models/saa_spose_response.rb +179 -0
- data/lib/AsposeDiagramCloud/models/save_as_response.rb +208 -0
- data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
- data/lib/AsposeDiagramCloud/models/save_options_request.rb +206 -0
- data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
- data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
- data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
- data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
- data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
- data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
- data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
- data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/version.rb +15 -0
- data/spec/_spec.rb +308 -0
- data/spec/api/test_convert_spec.rb +308 -0
- data/spec/api/test_drawing_spec.rb +136 -0
- data/spec/api/test_page_spec.rb +92 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/spec_helper.rb +120 -0
- data/testData/FileUpload.vdx +437 -0
- metadata +118 -49
@@ -0,0 +1,244 @@
|
|
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 DiagramSaveOptions
|
18
|
+
attr_accessor :save_format
|
19
|
+
|
20
|
+
attr_accessor :default_font
|
21
|
+
|
22
|
+
attr_accessor :auto_fit_page_to_drawing_content
|
23
|
+
|
24
|
+
class EnumAttributeValidator
|
25
|
+
attr_reader :datatype
|
26
|
+
attr_reader :allowable_values
|
27
|
+
|
28
|
+
def initialize(datatype, allowable_values)
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
30
|
+
case datatype.to_s
|
31
|
+
when /Integer/i
|
32
|
+
value.to_i
|
33
|
+
when /Float/i
|
34
|
+
value.to_f
|
35
|
+
else
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def valid?(value)
|
42
|
+
!value || allowable_values.include?(value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'save_format' => :'SaveFormat',
|
50
|
+
:'default_font' => :'DefaultFont',
|
51
|
+
:'auto_fit_page_to_drawing_content' => :'AutoFitPageToDrawingContent'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Attribute type mapping.
|
56
|
+
def self.swagger_types
|
57
|
+
{
|
58
|
+
:'save_format' => :'String',
|
59
|
+
:'default_font' => :'String',
|
60
|
+
:'auto_fit_page_to_drawing_content' => :'BOOLEAN'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Initializes the object
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
66
|
+
def initialize(attributes = {})
|
67
|
+
return unless attributes.is_a?(Hash)
|
68
|
+
|
69
|
+
# convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
71
|
+
|
72
|
+
if attributes.has_key?(:'SaveFormat')
|
73
|
+
self.save_format = attributes[:'SaveFormat']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'DefaultFont')
|
77
|
+
self.default_font = attributes[:'DefaultFont']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'AutoFitPageToDrawingContent')
|
81
|
+
self.auto_fit_page_to_drawing_content = attributes[:'AutoFitPageToDrawingContent']
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properies with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
if @save_format.nil?
|
91
|
+
invalid_properties.push("invalid value for 'save_format', save_format cannot be nil.")
|
92
|
+
end
|
93
|
+
|
94
|
+
return invalid_properties
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check to see if the all the properties in the model are valid
|
98
|
+
# @return true if the model is valid
|
99
|
+
def valid?
|
100
|
+
return false if @save_format.nil?
|
101
|
+
save_format_validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
102
|
+
return false unless save_format_validator.valid?(@save_format)
|
103
|
+
return true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Custom attribute writer method checking allowed values (enum).
|
107
|
+
# @param [Object] save_format Object to be assigned
|
108
|
+
def save_format=(save_format)
|
109
|
+
validator = EnumAttributeValidator.new('String', ["VDX", "VSX", "VTX", "TIFF", "PNG", "BMP", "EMF", "JPEG", "PDF", "XPS", "GIF", "HTML", "SVG", "SWF", "XAML", "VSDX", "VSTX", "VSSX", "VSDM", "VSSM", "VSTM"])
|
110
|
+
unless validator.valid?(save_format)
|
111
|
+
fail ArgumentError, "invalid value for 'save_format', must be one of #{validator.allowable_values}."
|
112
|
+
end
|
113
|
+
@save_format = save_format
|
114
|
+
end
|
115
|
+
|
116
|
+
# Checks equality by comparing each attribute.
|
117
|
+
# @param [Object] Object to be compared
|
118
|
+
def ==(o)
|
119
|
+
return true if self.equal?(o)
|
120
|
+
self.class == o.class &&
|
121
|
+
save_format == o.save_format &&
|
122
|
+
default_font == o.default_font &&
|
123
|
+
auto_fit_page_to_drawing_content == o.auto_fit_page_to_drawing_content
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Fixnum] Hash code
|
134
|
+
def hash
|
135
|
+
[save_format, default_font, auto_fit_page_to_drawing_content].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
144
|
+
if type =~ /\AArray<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
152
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
# Deserializes the data based on type
|
159
|
+
# @param string type Data type
|
160
|
+
# @param string value Value to be deserialized
|
161
|
+
# @return [Object] Deserialized data
|
162
|
+
def _deserialize(type, value)
|
163
|
+
case type.to_sym
|
164
|
+
when :DateTime
|
165
|
+
DateTime.parse(value)
|
166
|
+
when :Date
|
167
|
+
Date.parse(value)
|
168
|
+
when :String
|
169
|
+
value.to_s
|
170
|
+
when :Integer
|
171
|
+
value.to_i
|
172
|
+
when :Float
|
173
|
+
value.to_f
|
174
|
+
when :BOOLEAN
|
175
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
when :Object
|
181
|
+
# generic object (usually a Hash), return directly
|
182
|
+
value
|
183
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
184
|
+
inner_type = Regexp.last_match[:inner_type]
|
185
|
+
value.map { |v| _deserialize(inner_type, v) }
|
186
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
187
|
+
k_type = Regexp.last_match[:k_type]
|
188
|
+
v_type = Regexp.last_match[:v_type]
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each do |k, v|
|
191
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
else # model
|
195
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
196
|
+
temp_model.build_from_hash(value)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Returns the string representation of the object
|
201
|
+
# @return [String] String presentation of the object
|
202
|
+
def to_s
|
203
|
+
to_hash.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
208
|
+
def to_body
|
209
|
+
to_hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the object in the form of hash
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_hash
|
215
|
+
hash = {}
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
217
|
+
value = self.send(attr)
|
218
|
+
next if value.nil?
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map{ |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
@@ -0,0 +1,209 @@
|
|
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
|
+
# Class for disc space information.
|
17
|
+
class DiscUsage
|
18
|
+
# Application used disc space.
|
19
|
+
attr_accessor :used_size
|
20
|
+
|
21
|
+
# Total disc space.
|
22
|
+
attr_accessor :total_size
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'used_size' => :'UsedSize',
|
29
|
+
:'total_size' => :'TotalSize'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'used_size' => :'Integer',
|
37
|
+
:'total_size' => :'Integer'
|
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?(:'UsedSize')
|
50
|
+
self.used_size = attributes[:'UsedSize']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'TotalSize')
|
54
|
+
self.total_size = attributes[:'TotalSize']
|
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 @used_size.nil?
|
64
|
+
invalid_properties.push("invalid value for 'used_size', used_size cannot be nil.")
|
65
|
+
end
|
66
|
+
|
67
|
+
if @total_size.nil?
|
68
|
+
invalid_properties.push("invalid value for 'total_size', total_size cannot be nil.")
|
69
|
+
end
|
70
|
+
|
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 false if @used_size.nil?
|
78
|
+
return false if @total_size.nil?
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
used_size == o.used_size &&
|
88
|
+
total_size == o.total_size
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Fixnum] Hash code
|
99
|
+
def hash
|
100
|
+
[used_size, total_size].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def build_from_hash(attributes)
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
108
|
+
self.class.swagger_types.each_pair do |key, type|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :DateTime
|
130
|
+
DateTime.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :BOOLEAN
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
161
|
+
temp_model.build_from_hash(value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = self.send(attr)
|
183
|
+
next if value.nil?
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map{ |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|