groupdocs_comparison_cloud 18.9 → 21.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_comparison_cloud.rb +34 -42
- data/lib/groupdocs_comparison_cloud/api/compare_api.rb +411 -0
- data/lib/groupdocs_comparison_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_comparison_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_comparison_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_comparison_cloud/api/review_api.rb +314 -0
- data/lib/groupdocs_comparison_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_comparison_cloud/api_client.rb +7 -17
- data/lib/groupdocs_comparison_cloud/api_error.rb +19 -4
- data/lib/groupdocs_comparison_cloud/configuration.rb +3 -3
- data/lib/groupdocs_comparison_cloud/models/{comparison_change.rb → apply_revisions_options.rb} +65 -64
- data/lib/groupdocs_comparison_cloud/models/change_info.rb +371 -0
- data/lib/groupdocs_comparison_cloud/models/comparison_options.rb +298 -0
- data/lib/groupdocs_comparison_cloud/models/diagram_master_setting.rb +229 -0
- data/lib/groupdocs_comparison_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/error.rb +244 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_file_info.rb → error_details.rb} +39 -36
- data/lib/groupdocs_comparison_cloud/models/{style_settings_values.rb → file_info.rb} +51 -38
- data/lib/groupdocs_comparison_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_comparison_cloud/models/{value_type.rb → file_versions.rb} +33 -13
- data/lib/groupdocs_comparison_cloud/models/{comparison_changes_category_dto.rb → files_list.rb} +28 -30
- data/lib/groupdocs_comparison_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_comparison_cloud/models/format.rb +224 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_style_change.rb → formats_result.rb} +29 -19
- data/lib/groupdocs_comparison_cloud/models/info_result.rb +254 -0
- data/lib/groupdocs_comparison_cloud/models/items_style.rb +304 -0
- data/lib/groupdocs_comparison_cloud/models/link.rb +16 -8
- data/lib/groupdocs_comparison_cloud/models/{comparison_metadata_values.rb → metadata.rb} +28 -20
- data/lib/groupdocs_comparison_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_request.rb → page_info.rb} +56 -47
- data/lib/groupdocs_comparison_cloud/models/rectangle.rb +264 -0
- data/lib/groupdocs_comparison_cloud/models/revision_info.rb +322 -0
- data/lib/groupdocs_comparison_cloud/models/settings.rb +581 -0
- data/lib/groupdocs_comparison_cloud/models/size.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_comparison_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_comparison_cloud/models/style_change_info.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/updates_options.rb +310 -0
- data/lib/groupdocs_comparison_cloud/version.rb +2 -2
- metadata +35 -58
- data/lib/groupdocs_comparison_cloud/api/changes_api.rb +0 -470
- data/lib/groupdocs_comparison_cloud/api/comparison_api.rb +0 -365
- data/lib/groupdocs_comparison_cloud/models/color.rb +0 -1404
- data/lib/groupdocs_comparison_cloud/models/comparison_request_settings.rb +0 -378
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/post_categories_changes_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/post_changes_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_stream_request.rb +0 -45
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
|
-
# <copyright company="Aspose Pty Ltd" file="
|
4
|
-
# Copyright (c) 2003-
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="file_versions.rb">
|
4
|
+
# Copyright (c) 2003-2021 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,18 +28,23 @@
|
|
28
28
|
require 'date'
|
29
29
|
|
30
30
|
module GroupDocsComparisonCloud
|
31
|
-
|
32
|
-
class
|
31
|
+
# File versions FileVersion.
|
32
|
+
class FileVersions
|
33
|
+
|
34
|
+
# File versions FileVersion.
|
35
|
+
attr_accessor :value
|
33
36
|
|
34
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
35
38
|
def self.attribute_map
|
36
39
|
{
|
40
|
+
:'value' => :'Value'
|
37
41
|
}
|
38
42
|
end
|
39
43
|
|
40
44
|
# Attribute type mapping.
|
41
45
|
def self.swagger_types
|
42
46
|
{
|
47
|
+
:'value' => :'Array<FileVersion>'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -51,6 +56,12 @@ module GroupDocsComparisonCloud
|
|
51
56
|
# convert string to symbol for hash key
|
52
57
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
53
58
|
|
59
|
+
if attributes.key?(:'Value')
|
60
|
+
if (value = attributes[:'Value']).is_a?(Array)
|
61
|
+
self.value = value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
54
65
|
end
|
55
66
|
|
56
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -70,7 +81,8 @@ module GroupDocsComparisonCloud
|
|
70
81
|
# @param [Object] Object to be compared
|
71
82
|
def ==(other)
|
72
83
|
return true if self.equal?(other)
|
73
|
-
self.class == other.class
|
84
|
+
self.class == other.class &&
|
85
|
+
value == other.value
|
74
86
|
end
|
75
87
|
|
76
88
|
# @see the `==` method
|
@@ -82,7 +94,13 @@ module GroupDocsComparisonCloud
|
|
82
94
|
# Calculates hash code according to all attributes.
|
83
95
|
# @return [Fixnum] Hash code
|
84
96
|
def hash
|
85
|
-
[].hash
|
97
|
+
[value].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Downcases first letter.
|
101
|
+
# @return downcased string
|
102
|
+
def uncap(str)
|
103
|
+
str[0, 1].downcase + str[1..-1]
|
86
104
|
end
|
87
105
|
|
88
106
|
# Builds the object from hash
|
@@ -91,14 +109,16 @@ module GroupDocsComparisonCloud
|
|
91
109
|
def build_from_hash(attributes)
|
92
110
|
return nil unless attributes.is_a?(Hash)
|
93
111
|
self.class.swagger_types.each_pair do |key, type|
|
112
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
113
|
+
value = attributes[pname]
|
94
114
|
if type =~ /\AArray<(.*)>/i
|
95
115
|
# check to ensure the input is an array given that the the attribute
|
96
|
-
# is documented as an array but the input is not
|
97
|
-
if
|
98
|
-
self.send("#{key}=",
|
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) })
|
99
119
|
end
|
100
|
-
elsif !
|
101
|
-
self.send("#{key}=", _deserialize(type,
|
120
|
+
elsif !value.nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, value))
|
102
122
|
end
|
103
123
|
# or else data not found in attributes(hash), not an issue as the data can be optional
|
104
124
|
end
|
@@ -113,9 +133,9 @@ module GroupDocsComparisonCloud
|
|
113
133
|
def _deserialize(type, value)
|
114
134
|
case type.to_sym
|
115
135
|
when :DateTime
|
116
|
-
|
136
|
+
Date.parse value
|
117
137
|
when :Date
|
118
|
-
|
138
|
+
Date.parse value
|
119
139
|
when :String
|
120
140
|
value.to_s
|
121
141
|
when :Integer
|
data/lib/groupdocs_comparison_cloud/models/{comparison_changes_category_dto.rb → files_list.rb}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
|
-
# <copyright company="Aspose Pty Ltd" file="
|
4
|
-
# Copyright (c) 2003-
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="files_list.rb">
|
4
|
+
# Copyright (c) 2003-2021 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,23 @@
|
|
28
28
|
require 'date'
|
29
29
|
|
30
30
|
module GroupDocsComparisonCloud
|
31
|
-
|
32
|
-
class
|
31
|
+
# Files list
|
32
|
+
class FilesList
|
33
33
|
|
34
|
-
#
|
35
|
-
attr_accessor :
|
36
|
-
|
37
|
-
# The type change
|
38
|
-
attr_accessor :changes
|
34
|
+
# Files and folders contained by folder StorageFile.
|
35
|
+
attr_accessor :value
|
39
36
|
|
40
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
41
38
|
def self.attribute_map
|
42
39
|
{
|
43
|
-
:'
|
44
|
-
:'changes' => :'changes'
|
40
|
+
:'value' => :'Value'
|
45
41
|
}
|
46
42
|
end
|
47
43
|
|
48
44
|
# Attribute type mapping.
|
49
45
|
def self.swagger_types
|
50
46
|
{
|
51
|
-
:'
|
52
|
-
:'changes' => :'Array<ComparisonChange>'
|
47
|
+
:'value' => :'Array<StorageFile>'
|
53
48
|
}
|
54
49
|
end
|
55
50
|
|
@@ -61,13 +56,9 @@ module GroupDocsComparisonCloud
|
|
61
56
|
# convert string to symbol for hash key
|
62
57
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
58
|
|
64
|
-
if attributes.key?(:'
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
if attributes.key?(:'changes')
|
69
|
-
if (value = attributes[:'changes']).is_a?(Array)
|
70
|
-
self.changes = value
|
59
|
+
if attributes.key?(:'Value')
|
60
|
+
if (value = attributes[:'Value']).is_a?(Array)
|
61
|
+
self.value = value
|
71
62
|
end
|
72
63
|
end
|
73
64
|
|
@@ -91,8 +82,7 @@ module GroupDocsComparisonCloud
|
|
91
82
|
def ==(other)
|
92
83
|
return true if self.equal?(other)
|
93
84
|
self.class == other.class &&
|
94
|
-
|
95
|
-
changes == other.changes
|
85
|
+
value == other.value
|
96
86
|
end
|
97
87
|
|
98
88
|
# @see the `==` method
|
@@ -104,7 +94,13 @@ module GroupDocsComparisonCloud
|
|
104
94
|
# Calculates hash code according to all attributes.
|
105
95
|
# @return [Fixnum] Hash code
|
106
96
|
def hash
|
107
|
-
[
|
97
|
+
[value].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Downcases first letter.
|
101
|
+
# @return downcased string
|
102
|
+
def uncap(str)
|
103
|
+
str[0, 1].downcase + str[1..-1]
|
108
104
|
end
|
109
105
|
|
110
106
|
# Builds the object from hash
|
@@ -113,14 +109,16 @@ module GroupDocsComparisonCloud
|
|
113
109
|
def build_from_hash(attributes)
|
114
110
|
return nil unless attributes.is_a?(Hash)
|
115
111
|
self.class.swagger_types.each_pair do |key, type|
|
112
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
113
|
+
value = attributes[pname]
|
116
114
|
if type =~ /\AArray<(.*)>/i
|
117
115
|
# 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
|
120
|
-
self.send("#{key}=",
|
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) })
|
121
119
|
end
|
122
|
-
elsif !
|
123
|
-
self.send("#{key}=", _deserialize(type,
|
120
|
+
elsif !value.nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, value))
|
124
122
|
end
|
125
123
|
# or else data not found in attributes(hash), not an issue as the data can be optional
|
126
124
|
end
|
@@ -135,9 +133,9 @@ module GroupDocsComparisonCloud
|
|
135
133
|
def _deserialize(type, value)
|
136
134
|
case type.to_sym
|
137
135
|
when :DateTime
|
138
|
-
|
136
|
+
Date.parse value
|
139
137
|
when :Date
|
140
|
-
|
138
|
+
Date.parse value
|
141
139
|
when :String
|
142
140
|
value.to_s
|
143
141
|
when :Integer
|
@@ -0,0 +1,228 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="files_upload_result.rb">
|
4
|
+
# Copyright (c) 2003-2021 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 GroupDocsComparisonCloud
|
31
|
+
# File upload result
|
32
|
+
class FilesUploadResult
|
33
|
+
|
34
|
+
# List of uploaded file names
|
35
|
+
attr_accessor :uploaded
|
36
|
+
|
37
|
+
# List of errors.
|
38
|
+
attr_accessor :errors
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'uploaded' => :'Uploaded',
|
44
|
+
:'errors' => :'Errors'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'uploaded' => :'Array<String>',
|
52
|
+
:'errors' => :'Array<Error>'
|
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?(:'Uploaded')
|
65
|
+
if (value = attributes[:'Uploaded']).is_a?(Array)
|
66
|
+
self.uploaded = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'Errors')
|
71
|
+
if (value = attributes[:'Errors']).is_a?(Array)
|
72
|
+
self.errors = value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properies with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = []
|
82
|
+
return invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
return true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(other)
|
94
|
+
return true if self.equal?(other)
|
95
|
+
self.class == other.class &&
|
96
|
+
uploaded == other.uploaded &&
|
97
|
+
errors == other.errors
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(other)
|
103
|
+
self == other
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Fixnum] Hash code
|
108
|
+
def hash
|
109
|
+
[uploaded, errors].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Downcases first letter.
|
113
|
+
# @return downcased string
|
114
|
+
def uncap(str)
|
115
|
+
str[0, 1].downcase + str[1..-1]
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.swagger_types.each_pair do |key, type|
|
124
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
125
|
+
value = attributes[pname]
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if value.is_a?(Array)
|
130
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !value.nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, value))
|
134
|
+
end
|
135
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def _deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :DateTime
|
148
|
+
Date.parse value
|
149
|
+
when :Date
|
150
|
+
Date.parse value
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :BOOLEAN
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else
|
178
|
+
# model
|
179
|
+
temp_model = GroupDocsComparisonCloud.const_get(type).new
|
180
|
+
temp_model.build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
next if value.nil?
|
203
|
+
hash[param] = _to_hash(value)
|
204
|
+
end
|
205
|
+
hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Outputs non-array value in the form of hash
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
210
|
+
# @param [Object] value Any valid value
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
212
|
+
def _to_hash(value)
|
213
|
+
if value.is_a?(Array)
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
215
|
+
elsif value.is_a?(Hash)
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
+
end
|
219
|
+
elsif value.respond_to? :to_hash
|
220
|
+
value.to_hash
|
221
|
+
else
|
222
|
+
value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|