cloudmersive-convert-api-client 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -6
  3. data/docs/ConvertDataApi.md +2 -2
  4. data/docs/ConvertWebApi.md +50 -50
  5. data/docs/CreateZipArchiveRequest.md +9 -0
  6. data/docs/EditTextApi.md +232 -12
  7. data/docs/FindRegexMatch.md +12 -0
  8. data/docs/FindStringMatch.md +10 -0
  9. data/docs/FindStringRegexRequest.md +10 -0
  10. data/docs/FindStringRegexResponse.md +10 -0
  11. data/docs/FindStringSimpleRequest.md +9 -0
  12. data/docs/FindStringSimpleResponse.md +10 -0
  13. data/docs/ReplaceStringRegexRequest.md +10 -0
  14. data/docs/ReplaceStringRegexResponse.md +9 -0
  15. data/docs/ReplaceStringSimpleRequest.md +10 -0
  16. data/docs/ReplaceStringSimpleResponse.md +9 -0
  17. data/docs/ZipArchiveApi.md +167 -0
  18. data/docs/ZipDirectory.md +10 -0
  19. data/docs/ZipExtractResponse.md +10 -0
  20. data/docs/ZipFile.md +9 -0
  21. data/lib/cloudmersive-convert-api-client.rb +15 -0
  22. data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +2 -2
  23. data/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +61 -61
  24. data/lib/cloudmersive-convert-api-client/api/edit_text_api.rb +232 -12
  25. data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +181 -0
  26. data/lib/cloudmersive-convert-api-client/models/create_zip_archive_request.rb +203 -0
  27. data/lib/cloudmersive-convert-api-client/models/find_regex_match.rb +231 -0
  28. data/lib/cloudmersive-convert-api-client/models/find_string_match.rb +209 -0
  29. data/lib/cloudmersive-convert-api-client/models/find_string_regex_request.rb +209 -0
  30. data/lib/cloudmersive-convert-api-client/models/find_string_regex_response.rb +211 -0
  31. data/lib/cloudmersive-convert-api-client/models/find_string_simple_request.rb +199 -0
  32. data/lib/cloudmersive-convert-api-client/models/find_string_simple_response.rb +211 -0
  33. data/lib/cloudmersive-convert-api-client/models/replace_string_regex_request.rb +209 -0
  34. data/lib/cloudmersive-convert-api-client/models/replace_string_regex_response.rb +199 -0
  35. data/lib/cloudmersive-convert-api-client/models/replace_string_simple_request.rb +209 -0
  36. data/lib/cloudmersive-convert-api-client/models/replace_string_simple_response.rb +199 -0
  37. data/lib/cloudmersive-convert-api-client/models/zip_directory.rb +213 -0
  38. data/lib/cloudmersive-convert-api-client/models/zip_extract_response.rb +213 -0
  39. data/lib/cloudmersive-convert-api-client/models/zip_file.rb +215 -0
  40. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  41. data/spec/api/convert_data_api_spec.rb +1 -1
  42. data/spec/api/convert_web_api_spec.rb +13 -13
  43. data/spec/api/edit_text_api_spec.rb +54 -6
  44. data/spec/api/zip_archive_api_spec.rb +70 -0
  45. data/spec/models/create_zip_archive_request_spec.rb +48 -0
  46. data/spec/models/find_regex_match_spec.rb +66 -0
  47. data/spec/models/find_string_match_spec.rb +54 -0
  48. data/spec/models/find_string_regex_request_spec.rb +54 -0
  49. data/spec/models/find_string_regex_response_spec.rb +54 -0
  50. data/spec/models/find_string_simple_request_spec.rb +48 -0
  51. data/spec/models/find_string_simple_response_spec.rb +54 -0
  52. data/spec/models/replace_string_regex_request_spec.rb +54 -0
  53. data/spec/models/replace_string_regex_response_spec.rb +48 -0
  54. data/spec/models/replace_string_simple_request_spec.rb +54 -0
  55. data/spec/models/replace_string_simple_response_spec.rb +48 -0
  56. data/spec/models/zip_directory_spec.rb +54 -0
  57. data/spec/models/zip_extract_response_spec.rb +54 -0
  58. data/spec/models/zip_file_spec.rb +48 -0
  59. metadata +47 -2
@@ -0,0 +1,203 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Request to create a Zip Archive
17
+ class CreateZipArchiveRequest
18
+ # Top-level files in the root directory fo the zip file
19
+ attr_accessor :files_in_zip
20
+
21
+ # Top-level directories in the root directory of the zip; directories can contain sub-directories and files
22
+ attr_accessor :directories_in_zip
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'files_in_zip' => :'FilesInZip',
29
+ :'directories_in_zip' => :'DirectoriesInZip'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'files_in_zip' => :'Array<ZipFile>',
37
+ :'directories_in_zip' => :'Array<ZipDirectory>'
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?(:'FilesInZip')
50
+ if (value = attributes[:'FilesInZip']).is_a?(Array)
51
+ self.files_in_zip = value
52
+ end
53
+ end
54
+
55
+ if attributes.has_key?(:'DirectoriesInZip')
56
+ if (value = attributes[:'DirectoriesInZip']).is_a?(Array)
57
+ self.directories_in_zip = value
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ return invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ files_in_zip == o.files_in_zip &&
82
+ directories_in_zip == o.directories_in_zip
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [files_in_zip, directories_in_zip].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map{ |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+
201
+ end
202
+
203
+ end
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Individual regular expression match result of finding a target regex in a longer text string
17
+ class FindRegexMatch
18
+ # 0-based index of the start of the match
19
+ attr_accessor :character_offset_start
20
+
21
+ # 0-based index of the end of the match
22
+ attr_accessor :character_offset_end
23
+
24
+ # Text content of the line containing the match
25
+ attr_accessor :containing_line
26
+
27
+ # The match value
28
+ attr_accessor :match_value
29
+
30
+ # Regular expression regex match groups; these correspond to the match values
31
+ attr_accessor :match_groups
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'character_offset_start' => :'CharacterOffsetStart',
38
+ :'character_offset_end' => :'CharacterOffsetEnd',
39
+ :'containing_line' => :'ContainingLine',
40
+ :'match_value' => :'MatchValue',
41
+ :'match_groups' => :'MatchGroups'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'character_offset_start' => :'Integer',
49
+ :'character_offset_end' => :'Integer',
50
+ :'containing_line' => :'String',
51
+ :'match_value' => :'String',
52
+ :'match_groups' => :'Array<String>'
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.has_key?(:'CharacterOffsetStart')
65
+ self.character_offset_start = attributes[:'CharacterOffsetStart']
66
+ end
67
+
68
+ if attributes.has_key?(:'CharacterOffsetEnd')
69
+ self.character_offset_end = attributes[:'CharacterOffsetEnd']
70
+ end
71
+
72
+ if attributes.has_key?(:'ContainingLine')
73
+ self.containing_line = attributes[:'ContainingLine']
74
+ end
75
+
76
+ if attributes.has_key?(:'MatchValue')
77
+ self.match_value = attributes[:'MatchValue']
78
+ end
79
+
80
+ if attributes.has_key?(:'MatchGroups')
81
+ if (value = attributes[:'MatchGroups']).is_a?(Array)
82
+ self.match_groups = value
83
+ end
84
+ end
85
+
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ return invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ character_offset_start == o.character_offset_start &&
107
+ character_offset_end == o.character_offset_end &&
108
+ containing_line == o.containing_line &&
109
+ match_value == o.match_value &&
110
+ match_groups == o.match_groups
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Fixnum] Hash code
121
+ def hash
122
+ [character_offset_start, character_offset_end, containing_line, match_value, match_groups].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.swagger_types.each_pair do |key, type|
131
+ if type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :BOOLEAN
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
183
+ temp_model.build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ next if value.nil?
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map{ |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Individual match result of finding a target string in a longer text string
17
+ class FindStringMatch
18
+ # 0-based index of the start of the match
19
+ attr_accessor :character_offset_start
20
+
21
+ # 0-based index of the end of the match
22
+ attr_accessor :character_offset_end
23
+
24
+ # Text content of the line containing the match
25
+ attr_accessor :containing_line
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'character_offset_start' => :'CharacterOffsetStart',
32
+ :'character_offset_end' => :'CharacterOffsetEnd',
33
+ :'containing_line' => :'ContainingLine'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'character_offset_start' => :'Integer',
41
+ :'character_offset_end' => :'Integer',
42
+ :'containing_line' => :'String'
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?(:'CharacterOffsetStart')
55
+ self.character_offset_start = attributes[:'CharacterOffsetStart']
56
+ end
57
+
58
+ if attributes.has_key?(:'CharacterOffsetEnd')
59
+ self.character_offset_end = attributes[:'CharacterOffsetEnd']
60
+ end
61
+
62
+ if attributes.has_key?(:'ContainingLine')
63
+ self.containing_line = attributes[:'ContainingLine']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ character_offset_start == o.character_offset_start &&
87
+ character_offset_end == o.character_offset_end &&
88
+ containing_line == o.containing_line
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
+ [character_offset_start, character_offset_end, containing_line].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 = CloudmersiveConvertApiClient.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