aspose_cells_cloud 21.5 → 21.6
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.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/lib/aspose_cells_cloud.rb +3 -0
- data/lib/aspose_cells_cloud/api/lite_cells_api.rb +893 -0
- data/lib/aspose_cells_cloud/api_client.rb +3 -3
- data/lib/aspose_cells_cloud/models/cells_document_property.rb +46 -13
- data/lib/aspose_cells_cloud/models/file_info.rb +221 -0
- data/lib/aspose_cells_cloud/models/files_result.rb +200 -0
- data/lib/aspose_cells_cloud/models/pivot_item.rb +1 -1
- data/lib/aspose_cells_cloud/version.rb +1 -1
- data/spec/api/cells_assembly_spec.rb +44 -0
- data/spec/api/cells_clear_objects_spec.rb +43 -0
- data/spec/api/cells_export_spec.rb +43 -0
- data/spec/api/cells_merge_spec.rb +43 -0
- data/spec/api/cells_metadata_spec.rb +72 -0
- data/spec/api/cells_properties_api_spec.rb +1 -1
- data/spec/api/cells_protect_spec.rb +43 -0
- data/spec/api/cells_search_spec.rb +43 -0
- data/spec/api/cells_split_spec.rb +44 -0
- data/spec/api/cells_unlock_spec.rb +43 -0
- data/spec/api/cells_watermark_spec.rb +42 -0
- data/spec/spec_helper.rb +3 -0
- metadata +15 -2
@@ -131,13 +131,13 @@ module AsposeCellsCloud
|
|
131
131
|
if @config.access_token
|
132
132
|
add_o_auth_token(req_opts)
|
133
133
|
end
|
134
|
-
|
134
|
+
#, :proxy => "http://127.0.0.1:8888"
|
135
135
|
conn = Faraday.new url, {:params => query_params, :headers => header_params} do |f|
|
136
136
|
f.request :multipart
|
137
137
|
f.request :url_encoded
|
138
138
|
f.adapter Faraday.default_adapter
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
if req_opts[:body] == {}
|
142
142
|
req_opts[:body] = nil
|
143
143
|
end
|
@@ -307,7 +307,7 @@ module AsposeCellsCloud
|
|
307
307
|
form_params.each do |key, value|
|
308
308
|
case value
|
309
309
|
when ::File
|
310
|
-
data[key] = Faraday::UploadIO.new(value.path, MimeMagic
|
310
|
+
data[key] = Faraday::UploadIO.new(value.path, "application/octet-stream", key) #MimeMagic::by_magic(value).to_s
|
311
311
|
when ::Array, nil
|
312
312
|
# let typhoeus handle File, Array and nil parameters
|
313
313
|
data[key] = value
|
@@ -27,20 +27,35 @@ module AsposeCellsCloud
|
|
27
27
|
class CellsDocumentProperty
|
28
28
|
attr_accessor :link
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# Returns the name of the property.
|
32
31
|
attr_accessor :name
|
33
32
|
|
33
|
+
# Gets or sets the value of the property.
|
34
34
|
attr_accessor :value
|
35
35
|
|
36
|
+
# Indicates whether this property is linked to content
|
37
|
+
attr_accessor :is_linked_to_content
|
38
|
+
|
39
|
+
# The linked content source.
|
40
|
+
attr_accessor :source
|
41
|
+
|
42
|
+
# Gets the data type of the property.
|
43
|
+
attr_accessor :type
|
44
|
+
|
45
|
+
# Returns true if this property does not have a name in the OLE2 storage and a unique name was generated only for the public API.
|
46
|
+
attr_accessor :is_generated_name
|
47
|
+
|
36
48
|
|
37
49
|
# Attribute mapping from ruby-style variable name to JSON key.
|
38
50
|
def self.attribute_map
|
39
51
|
{
|
40
52
|
:'link' => :'link',
|
41
|
-
:'built_in' => :'BuiltIn',
|
42
53
|
:'name' => :'Name',
|
43
|
-
:'value' => :'Value'
|
54
|
+
:'value' => :'Value',
|
55
|
+
:'is_linked_to_content' => :'IsLinkedToContent',
|
56
|
+
:'source' => :'Source',
|
57
|
+
:'type' => :'Type',
|
58
|
+
:'is_generated_name' => :'IsGeneratedName'
|
44
59
|
}
|
45
60
|
end
|
46
61
|
|
@@ -48,9 +63,12 @@ module AsposeCellsCloud
|
|
48
63
|
def self.swagger_types
|
49
64
|
{
|
50
65
|
:'link' => :'Link',
|
51
|
-
:'built_in' => :'String',
|
52
66
|
:'name' => :'String',
|
53
|
-
:'value' => :'String'
|
67
|
+
:'value' => :'String',
|
68
|
+
:'is_linked_to_content' => :'String',
|
69
|
+
:'source' => :'String',
|
70
|
+
:'type' => :'String',
|
71
|
+
:'is_generated_name' => :'String'
|
54
72
|
}
|
55
73
|
end
|
56
74
|
|
@@ -66,10 +84,6 @@ module AsposeCellsCloud
|
|
66
84
|
self.link = attributes[:'link']
|
67
85
|
end
|
68
86
|
|
69
|
-
if attributes.has_key?(:'BuiltIn')
|
70
|
-
self.built_in = attributes[:'BuiltIn']
|
71
|
-
end
|
72
|
-
|
73
87
|
if attributes.has_key?(:'Name')
|
74
88
|
self.name = attributes[:'Name']
|
75
89
|
end
|
@@ -78,6 +92,22 @@ module AsposeCellsCloud
|
|
78
92
|
self.value = attributes[:'Value']
|
79
93
|
end
|
80
94
|
|
95
|
+
if attributes.has_key?(:'IsLinkedToContent')
|
96
|
+
self.is_linked_to_content = attributes[:'IsLinkedToContent']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'Source')
|
100
|
+
self.source = attributes[:'Source']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.has_key?(:'Type')
|
104
|
+
self.type = attributes[:'Type']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'IsGeneratedName')
|
108
|
+
self.is_generated_name = attributes[:'IsGeneratedName']
|
109
|
+
end
|
110
|
+
|
81
111
|
end
|
82
112
|
|
83
113
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -99,9 +129,12 @@ module AsposeCellsCloud
|
|
99
129
|
return true if self.equal?(o)
|
100
130
|
self.class == o.class &&
|
101
131
|
link == o.link &&
|
102
|
-
built_in == o.built_in &&
|
103
132
|
name == o.name &&
|
104
|
-
value == o.value
|
133
|
+
value == o.value &&
|
134
|
+
is_linked_to_content == o.is_linked_to_content &&
|
135
|
+
source == o.source &&
|
136
|
+
type == o.type &&
|
137
|
+
is_generated_name == o.is_generated_name
|
105
138
|
end
|
106
139
|
|
107
140
|
# @see the `==` method
|
@@ -113,7 +146,7 @@ module AsposeCellsCloud
|
|
113
146
|
# Calculates hash code according to all attributes.
|
114
147
|
# @return [Fixnum] Hash code
|
115
148
|
def hash
|
116
|
-
[link,
|
149
|
+
[link, name, value, is_linked_to_content, source, type, is_generated_name].hash
|
117
150
|
end
|
118
151
|
|
119
152
|
# Builds the object from hash
|
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2021 Aspose.Cells Cloud
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
|
21
|
+
=end
|
22
|
+
|
23
|
+
require 'date'
|
24
|
+
|
25
|
+
module AsposeCellsCloud
|
26
|
+
|
27
|
+
class FileInfo
|
28
|
+
attr_accessor :filename
|
29
|
+
|
30
|
+
attr_accessor :file_size
|
31
|
+
|
32
|
+
attr_accessor :file_content
|
33
|
+
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'filename' => :'Filename',
|
39
|
+
:'file_size' => :'FileSize',
|
40
|
+
:'file_content' => :'FileContent'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.swagger_types
|
46
|
+
{
|
47
|
+
:'filename' => :'String',
|
48
|
+
:'file_size' => :'Integer',
|
49
|
+
:'file_content' => :'String'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
return unless attributes.is_a?(Hash)
|
57
|
+
|
58
|
+
# convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
60
|
+
|
61
|
+
if attributes.has_key?(:'Filename')
|
62
|
+
self.filename = attributes[:'Filename']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'FileSize')
|
66
|
+
self.file_size = attributes[:'FileSize']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'FileContent')
|
70
|
+
self.file_content = attributes[:'FileContent']
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properies with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @file_size.nil?
|
80
|
+
invalid_properties.push("invalid value for 'file_size', file_size cannot be nil.")
|
81
|
+
end
|
82
|
+
|
83
|
+
return invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return false if @file_size.nil?
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
filename == o.filename &&
|
99
|
+
file_size == o.file_size &&
|
100
|
+
file_content == o.file_content
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Fixnum] Hash code
|
111
|
+
def hash
|
112
|
+
[filename, file_size, file_content].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def build_from_hash(attributes)
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
120
|
+
self.class.swagger_types.each_pair do |key, type|
|
121
|
+
if type =~ /\AArray<(.*)>/i
|
122
|
+
# check to ensure the input is an array given that the the attribute
|
123
|
+
# is documented as an array but the input is not
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
126
|
+
end
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
130
|
+
end
|
131
|
+
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deserializes the data based on type
|
136
|
+
# @param string type Data type
|
137
|
+
# @param string value Value to be deserialized
|
138
|
+
# @return [Object] Deserialized data
|
139
|
+
def _deserialize(type, value)
|
140
|
+
case type.to_sym
|
141
|
+
when :DateTime
|
142
|
+
DateTime.parse(value)
|
143
|
+
when :Date
|
144
|
+
Date.parse(value)
|
145
|
+
when :String
|
146
|
+
value.to_s
|
147
|
+
when :Integer
|
148
|
+
value.to_i
|
149
|
+
when :Float
|
150
|
+
value.to_f
|
151
|
+
when :BOOLEAN
|
152
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
+
true
|
154
|
+
else
|
155
|
+
false
|
156
|
+
end
|
157
|
+
when :Object
|
158
|
+
# generic object (usually a Hash), return directly
|
159
|
+
value
|
160
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
+
inner_type = Regexp.last_match[:inner_type]
|
162
|
+
value.map { |v| _deserialize(inner_type, v) }
|
163
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
+
k_type = Regexp.last_match[:k_type]
|
165
|
+
v_type = Regexp.last_match[:v_type]
|
166
|
+
{}.tap do |hash|
|
167
|
+
value.each do |k, v|
|
168
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else # model
|
172
|
+
temp_model = AsposeCellsCloud.const_get(type).new
|
173
|
+
temp_model.build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
next if value.nil?
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map{ |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2021 Aspose.Cells Cloud
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
|
21
|
+
=end
|
22
|
+
|
23
|
+
require 'date'
|
24
|
+
|
25
|
+
module AsposeCellsCloud
|
26
|
+
|
27
|
+
class FilesResult
|
28
|
+
attr_accessor :files
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'files' => :'Files'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'files' => :'Array<FileInfo>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
52
|
+
|
53
|
+
if attributes.has_key?(:'Files')
|
54
|
+
if (value = attributes[:'Files']).is_a?(Array)
|
55
|
+
self.files = value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properies with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
return invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
return true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def ==(o)
|
77
|
+
return true if self.equal?(o)
|
78
|
+
self.class == o.class &&
|
79
|
+
files == o.files
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def eql?(o)
|
85
|
+
self == o
|
86
|
+
end
|
87
|
+
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Fixnum] Hash code
|
90
|
+
def hash
|
91
|
+
[files].hash
|
92
|
+
end
|
93
|
+
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def build_from_hash(attributes)
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
99
|
+
self.class.swagger_types.each_pair do |key, type|
|
100
|
+
if type =~ /\AArray<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the the attribute
|
102
|
+
# is documented as an array but the input is not
|
103
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
104
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
105
|
+
end
|
106
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
107
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
109
|
+
end
|
110
|
+
|
111
|
+
self
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
118
|
+
def _deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :DateTime
|
121
|
+
DateTime.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :String
|
125
|
+
value.to_s
|
126
|
+
when :Integer
|
127
|
+
value.to_i
|
128
|
+
when :Float
|
129
|
+
value.to_f
|
130
|
+
when :BOOLEAN
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
132
|
+
true
|
133
|
+
else
|
134
|
+
false
|
135
|
+
end
|
136
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
139
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
140
|
+
inner_type = Regexp.last_match[:inner_type]
|
141
|
+
value.map { |v| _deserialize(inner_type, v) }
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
143
|
+
k_type = Regexp.last_match[:k_type]
|
144
|
+
v_type = Regexp.last_match[:v_type]
|
145
|
+
{}.tap do |hash|
|
146
|
+
value.each do |k, v|
|
147
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else # model
|
151
|
+
temp_model = AsposeCellsCloud.const_get(type).new
|
152
|
+
temp_model.build_from_hash(value)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the string representation of the object
|
157
|
+
# @return [String] String presentation of the object
|
158
|
+
def to_s
|
159
|
+
to_hash.to_s
|
160
|
+
end
|
161
|
+
|
162
|
+
# to_body is an alias to to_hash (backward compatibility)
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
164
|
+
def to_body
|
165
|
+
to_hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_hash
|
171
|
+
hash = {}
|
172
|
+
self.class.attribute_map.each_pair do |attr, param|
|
173
|
+
value = self.send(attr)
|
174
|
+
next if value.nil?
|
175
|
+
hash[param] = _to_hash(value)
|
176
|
+
end
|
177
|
+
hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Outputs non-array value in the form of hash
|
181
|
+
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
# @param [Object] value Any valid value
|
183
|
+
# @return [Hash] Returns the value in the form of hash
|
184
|
+
def _to_hash(value)
|
185
|
+
if value.is_a?(Array)
|
186
|
+
value.compact.map{ |v| _to_hash(v) }
|
187
|
+
elsif value.is_a?(Hash)
|
188
|
+
{}.tap do |hash|
|
189
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
190
|
+
end
|
191
|
+
elsif value.respond_to? :to_hash
|
192
|
+
value.to_hash
|
193
|
+
else
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|