groupdocs_editor_cloud 19.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/groupdocs_editor_cloud.rb +70 -0
- data/lib/groupdocs_editor_cloud/api/edit_api.rb +314 -0
- data/lib/groupdocs_editor_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_editor_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_editor_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_editor_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_editor_cloud/api_client.rb +380 -0
- data/lib/groupdocs_editor_cloud/api_error.rb +58 -0
- data/lib/groupdocs_editor_cloud/configuration.rb +95 -0
- data/lib/groupdocs_editor_cloud/models/delimited_text_load_options.rb +279 -0
- data/lib/groupdocs_editor_cloud/models/delimited_text_save_options.rb +304 -0
- data/lib/groupdocs_editor_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_editor_cloud/models/document_result.rb +214 -0
- data/lib/groupdocs_editor_cloud/models/error.rb +244 -0
- data/lib/groupdocs_editor_cloud/models/error_details.rb +229 -0
- data/lib/groupdocs_editor_cloud/models/file_info.rb +244 -0
- data/lib/groupdocs_editor_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_editor_cloud/models/file_versions.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/files_list.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_editor_cloud/models/format.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/formats_result.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/info_result.rb +269 -0
- data/lib/groupdocs_editor_cloud/models/load_options.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/load_result.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_editor_cloud/models/options.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/pdf_save_options.rb +316 -0
- data/lib/groupdocs_editor_cloud/models/presentation_load_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/presentation_save_options.rb +264 -0
- data/lib/groupdocs_editor_cloud/models/save_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/spreadsheet_load_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/spreadsheet_save_options.rb +326 -0
- data/lib/groupdocs_editor_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_editor_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_editor_cloud/models/text_load_options.rb +347 -0
- data/lib/groupdocs_editor_cloud/models/text_save_options.rb +294 -0
- data/lib/groupdocs_editor_cloud/models/word_processing_load_options.rb +306 -0
- data/lib/groupdocs_editor_cloud/models/word_processing_save_options.rb +371 -0
- data/lib/groupdocs_editor_cloud/models/xml_load_options.rb +346 -0
- data/lib/groupdocs_editor_cloud/version.rb +29 -0
- metadata +153 -0
@@ -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 GroupDocsEditorCloud
|
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 = GroupDocsEditorCloud.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,269 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="info_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 GroupDocsEditorCloud
|
31
|
+
# Describes document properties result
|
32
|
+
class InfoResult
|
33
|
+
|
34
|
+
# Pages count
|
35
|
+
attr_accessor :page_count
|
36
|
+
|
37
|
+
# Document size in bytes
|
38
|
+
attr_accessor :size
|
39
|
+
|
40
|
+
# Indicates whether specific file is encrypted and requires password for opening.
|
41
|
+
attr_accessor :is_encrypted
|
42
|
+
|
43
|
+
# File format
|
44
|
+
attr_accessor :file_format
|
45
|
+
|
46
|
+
# Document extension
|
47
|
+
attr_accessor :extension
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'page_count' => :'PageCount',
|
53
|
+
:'size' => :'Size',
|
54
|
+
:'is_encrypted' => :'IsEncrypted',
|
55
|
+
:'file_format' => :'FileFormat',
|
56
|
+
:'extension' => :'Extension'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.swagger_types
|
62
|
+
{
|
63
|
+
:'page_count' => :'Integer',
|
64
|
+
:'size' => :'Integer',
|
65
|
+
:'is_encrypted' => :'BOOLEAN',
|
66
|
+
:'file_format' => :'String',
|
67
|
+
:'extension' => :'String'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
return unless attributes.is_a?(Hash)
|
75
|
+
|
76
|
+
# convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
78
|
+
|
79
|
+
if attributes.key?(:'PageCount')
|
80
|
+
self.page_count = attributes[:'PageCount']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'Size')
|
84
|
+
self.size = attributes[:'Size']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'IsEncrypted')
|
88
|
+
self.is_encrypted = attributes[:'IsEncrypted']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'FileFormat')
|
92
|
+
self.file_format = attributes[:'FileFormat']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'Extension')
|
96
|
+
self.extension = attributes[:'Extension']
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
102
|
+
# @return Array for valid properies with the reasons
|
103
|
+
def list_invalid_properties
|
104
|
+
invalid_properties = []
|
105
|
+
if @page_count.nil?
|
106
|
+
invalid_properties.push("invalid value for 'page_count', page_count cannot be nil.")
|
107
|
+
end
|
108
|
+
|
109
|
+
if @size.nil?
|
110
|
+
invalid_properties.push("invalid value for 'size', size cannot be nil.")
|
111
|
+
end
|
112
|
+
|
113
|
+
if @is_encrypted.nil?
|
114
|
+
invalid_properties.push("invalid value for 'is_encrypted', is_encrypted cannot be nil.")
|
115
|
+
end
|
116
|
+
|
117
|
+
return invalid_properties
|
118
|
+
end
|
119
|
+
|
120
|
+
# Check to see if the all the properties in the model are valid
|
121
|
+
# @return true if the model is valid
|
122
|
+
def valid?
|
123
|
+
return false if @page_count.nil?
|
124
|
+
return false if @size.nil?
|
125
|
+
return false if @is_encrypted.nil?
|
126
|
+
return true
|
127
|
+
end
|
128
|
+
|
129
|
+
# Checks equality by comparing each attribute.
|
130
|
+
# @param [Object] Object to be compared
|
131
|
+
def ==(other)
|
132
|
+
return true if self.equal?(other)
|
133
|
+
self.class == other.class &&
|
134
|
+
page_count == other.page_count &&
|
135
|
+
size == other.size &&
|
136
|
+
is_encrypted == other.is_encrypted &&
|
137
|
+
file_format == other.file_format &&
|
138
|
+
extension == other.extension
|
139
|
+
end
|
140
|
+
|
141
|
+
# @see the `==` method
|
142
|
+
# @param [Object] Object to be compared
|
143
|
+
def eql?(other)
|
144
|
+
self == other
|
145
|
+
end
|
146
|
+
|
147
|
+
# Calculates hash code according to all attributes.
|
148
|
+
# @return [Fixnum] Hash code
|
149
|
+
def hash
|
150
|
+
[page_count, size, is_encrypted, file_format, extension].hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Downcases first letter.
|
154
|
+
# @return downcased string
|
155
|
+
def uncap(str)
|
156
|
+
str[0, 1].downcase + str[1..-1]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Builds the object from hash
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
161
|
+
# @return [Object] Returns the model itself
|
162
|
+
def build_from_hash(attributes)
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
164
|
+
self.class.swagger_types.each_pair do |key, type|
|
165
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
166
|
+
value = attributes[pname]
|
167
|
+
if type =~ /\AArray<(.*)>/i
|
168
|
+
# check to ensure the input is an array given that the the attribute
|
169
|
+
# is documented as an array but the input is not
|
170
|
+
if value.is_a?(Array)
|
171
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
172
|
+
end
|
173
|
+
elsif !value.nil?
|
174
|
+
self.send("#{key}=", _deserialize(type, value))
|
175
|
+
end
|
176
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
177
|
+
end
|
178
|
+
|
179
|
+
self
|
180
|
+
end
|
181
|
+
|
182
|
+
# Deserializes the data based on type
|
183
|
+
# @param string type Data type
|
184
|
+
# @param string value Value to be deserialized
|
185
|
+
# @return [Object] Deserialized data
|
186
|
+
def _deserialize(type, value)
|
187
|
+
case type.to_sym
|
188
|
+
when :DateTime
|
189
|
+
Date.parse value
|
190
|
+
when :Date
|
191
|
+
Date.parse value
|
192
|
+
when :String
|
193
|
+
value.to_s
|
194
|
+
when :Integer
|
195
|
+
value.to_i
|
196
|
+
when :Float
|
197
|
+
value.to_f
|
198
|
+
when :BOOLEAN
|
199
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
200
|
+
true
|
201
|
+
else
|
202
|
+
false
|
203
|
+
end
|
204
|
+
when :Object
|
205
|
+
# generic object (usually a Hash), return directly
|
206
|
+
value
|
207
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
208
|
+
inner_type = Regexp.last_match[:inner_type]
|
209
|
+
value.map { |v| _deserialize(inner_type, v) }
|
210
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
211
|
+
k_type = Regexp.last_match[:k_type]
|
212
|
+
v_type = Regexp.last_match[:v_type]
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each do |k, v|
|
215
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
else
|
219
|
+
# model
|
220
|
+
temp_model = GroupDocsEditorCloud.const_get(type).new
|
221
|
+
temp_model.build_from_hash(value)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the string representation of the object
|
226
|
+
# @return [String] String presentation of the object
|
227
|
+
def to_s
|
228
|
+
to_hash.to_s
|
229
|
+
end
|
230
|
+
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
233
|
+
def to_body
|
234
|
+
to_hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Returns the object in the form of hash
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
239
|
+
def to_hash
|
240
|
+
hash = {}
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
242
|
+
value = self.send(attr)
|
243
|
+
next if value.nil?
|
244
|
+
hash[param] = _to_hash(value)
|
245
|
+
end
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|