cloudmersive-convert-api-client 2.2.1 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -8
  3. data/docs/DocumentEditingEditSession.md +9 -0
  4. data/docs/DocumentTransformEditSession.md +9 -0
  5. data/docs/DocxContentControl.md +8 -0
  6. data/docs/DocxSetFormFieldsRequest.md +10 -0
  7. data/docs/DocxTableSingleTableFill.md +10 -0
  8. data/docs/DocxTableTableFillMultiRequest.md +10 -0
  9. data/docs/EditDocumentApi.md +223 -3
  10. data/docs/FillHandlebarFormField.md +9 -0
  11. data/docs/GetDocxContentControlsResponse.md +9 -0
  12. data/docs/GetDocxGetFormFieldsResponse.md +10 -0
  13. data/docs/HandlebarFormField.md +8 -0
  14. data/docs/TransformDocumentApi.md +185 -9
  15. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +220 -2
  16. data/lib/cloudmersive-convert-api-client/api/transform_document_api.rb +183 -6
  17. data/lib/cloudmersive-convert-api-client/models/document_editing_edit_session.rb +196 -0
  18. data/lib/cloudmersive-convert-api-client/models/document_transform_edit_session.rb +196 -0
  19. data/lib/cloudmersive-convert-api-client/models/docx_content_control.rb +186 -0
  20. data/lib/cloudmersive-convert-api-client/models/docx_set_form_fields_request.rb +223 -0
  21. data/lib/cloudmersive-convert-api-client/models/docx_table_single_table_fill.rb +208 -0
  22. data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_multi_request.rb +223 -0
  23. data/lib/cloudmersive-convert-api-client/models/fill_handlebar_form_field.rb +196 -0
  24. data/lib/cloudmersive-convert-api-client/models/get_docx_content_controls_response.rb +198 -0
  25. data/lib/cloudmersive-convert-api-client/models/get_docx_get_form_fields_response.rb +210 -0
  26. data/lib/cloudmersive-convert-api-client/models/handlebar_form_field.rb +186 -0
  27. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  28. data/lib/cloudmersive-convert-api-client.rb +10 -0
  29. data/spec/api/edit_document_api_spec.rb +49 -1
  30. data/spec/api/transform_document_api_spec.rb +43 -3
  31. data/spec/models/document_editing_edit_session_spec.rb +47 -0
  32. data/spec/models/document_transform_edit_session_spec.rb +47 -0
  33. data/spec/models/docx_content_control_spec.rb +41 -0
  34. data/spec/models/docx_set_form_fields_request_spec.rb +53 -0
  35. data/spec/models/docx_table_single_table_fill_spec.rb +53 -0
  36. data/spec/models/docx_table_table_fill_multi_request_spec.rb +53 -0
  37. data/spec/models/fill_handlebar_form_field_spec.rb +47 -0
  38. data/spec/models/get_docx_content_controls_response_spec.rb +47 -0
  39. data/spec/models/get_docx_get_form_fields_response_spec.rb +53 -0
  40. data/spec/models/handlebar_form_field_spec.rb +41 -0
  41. metadata +32 -2
@@ -19,7 +19,7 @@ module CloudmersiveConvertApiClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Replace string in Word DOCX document
22
+ # Replace string in Word DOCX document, return result
23
23
  # Replace all instances of a string in an Office Word Document (docx)
24
24
  # @param match_string String to search for and match against, to be replaced
25
25
  # @param replace_string String to replace the matched values with
@@ -33,7 +33,7 @@ module CloudmersiveConvertApiClient
33
33
  data
34
34
  end
35
35
 
36
- # Replace string in Word DOCX document
36
+ # Replace string in Word DOCX document, return result
37
37
  # Replace all instances of a string in an Office Word Document (docx)
38
38
  # @param match_string String to search for and match against, to be replaced
39
39
  # @param replace_string String to replace the matched values with
@@ -88,7 +88,76 @@ module CloudmersiveConvertApiClient
88
88
  end
89
89
  return data, status_code, headers
90
90
  end
91
- # Fill in data in a table in a Word DOCX document
91
+ # Replace string in Word DOCX document, return edit session
92
+ # Replace all instances of a string in an Office Word Document (docx). Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
93
+ # @param match_string String to search for and match against, to be replaced
94
+ # @param replace_string String to replace the matched values with
95
+ # @param [Hash] opts the optional parameters
96
+ # @option opts [File] :input_file Optional: Input file to perform the operation on.
97
+ # @option opts [String] :input_file_url Optional: URL of a file to operate on as input. This can be a public URL, or you can also use the begin-editing API (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
98
+ # @option opts [BOOLEAN] :match_case Optional: True if the case should be matched, false for case insensitive match. Default is false.
99
+ # @return [DocumentTransformEditSession]
100
+ def transform_document_docx_replace_edit_session(match_string, replace_string, opts = {})
101
+ data, _status_code, _headers = transform_document_docx_replace_edit_session_with_http_info(match_string, replace_string, opts)
102
+ data
103
+ end
104
+
105
+ # Replace string in Word DOCX document, return edit session
106
+ # Replace all instances of a string in an Office Word Document (docx). Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
107
+ # @param match_string String to search for and match against, to be replaced
108
+ # @param replace_string String to replace the matched values with
109
+ # @param [Hash] opts the optional parameters
110
+ # @option opts [File] :input_file Optional: Input file to perform the operation on.
111
+ # @option opts [String] :input_file_url Optional: URL of a file to operate on as input. This can be a public URL, or you can also use the begin-editing API (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
112
+ # @option opts [BOOLEAN] :match_case Optional: True if the case should be matched, false for case insensitive match. Default is false.
113
+ # @return [Array<(DocumentTransformEditSession, Fixnum, Hash)>] DocumentTransformEditSession data, response status code and response headers
114
+ def transform_document_docx_replace_edit_session_with_http_info(match_string, replace_string, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_replace_edit_session ...'
117
+ end
118
+ # verify the required parameter 'match_string' is set
119
+ if @api_client.config.client_side_validation && match_string.nil?
120
+ fail ArgumentError, "Missing the required parameter 'match_string' when calling TransformDocumentApi.transform_document_docx_replace_edit_session"
121
+ end
122
+ # verify the required parameter 'replace_string' is set
123
+ if @api_client.config.client_side_validation && replace_string.nil?
124
+ fail ArgumentError, "Missing the required parameter 'replace_string' when calling TransformDocumentApi.transform_document_docx_replace_edit_session"
125
+ end
126
+ # resource path
127
+ local_var_path = '/convert/transform/docx/replace-all/edit-session'
128
+
129
+ # query parameters
130
+ query_params = {}
131
+
132
+ # header parameters
133
+ header_params = {}
134
+ # HTTP header 'Accept' (if needed)
135
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
136
+ header_params[:'matchString'] = match_string
137
+ header_params[:'replaceString'] = replace_string
138
+ header_params[:'inputFileUrl'] = opts[:'input_file_url'] if !opts[:'input_file_url'].nil?
139
+ header_params[:'matchCase'] = opts[:'match_case'] if !opts[:'match_case'].nil?
140
+
141
+ # form parameters
142
+ form_params = {}
143
+ form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
144
+
145
+ # http body (model)
146
+ post_body = nil
147
+ auth_names = ['Apikey']
148
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => 'DocumentTransformEditSession')
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_replace_edit_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
+ end
158
+ return data, status_code, headers
159
+ end
160
+ # Fill in data in a table in a Word DOCX document, return result
92
161
  # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
93
162
  # @param request
94
163
  # @param [Hash] opts the optional parameters
@@ -98,7 +167,7 @@ module CloudmersiveConvertApiClient
98
167
  data
99
168
  end
100
169
 
101
- # Fill in data in a table in a Word DOCX document
170
+ # Fill in data in a table in a Word DOCX document, return result
102
171
  # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
103
172
  # @param request
104
173
  # @param [Hash] opts the optional parameters
@@ -142,7 +211,115 @@ module CloudmersiveConvertApiClient
142
211
  end
143
212
  return data, status_code, headers
144
213
  end
145
- # Replace string in PowerPoint PPTX presentation
214
+ # Fill in data in a table in a Word DOCX document, return edit session
215
+ # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates. Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
216
+ # @param request
217
+ # @param [Hash] opts the optional parameters
218
+ # @return [DocumentTransformEditSession]
219
+ def transform_document_docx_table_fill_in_edit_session(request, opts = {})
220
+ data, _status_code, _headers = transform_document_docx_table_fill_in_edit_session_with_http_info(request, opts)
221
+ data
222
+ end
223
+
224
+ # Fill in data in a table in a Word DOCX document, return edit session
225
+ # Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates. Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
226
+ # @param request
227
+ # @param [Hash] opts the optional parameters
228
+ # @return [Array<(DocumentTransformEditSession, Fixnum, Hash)>] DocumentTransformEditSession data, response status code and response headers
229
+ def transform_document_docx_table_fill_in_edit_session_with_http_info(request, opts = {})
230
+ if @api_client.config.debugging
231
+ @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_table_fill_in_edit_session ...'
232
+ end
233
+ # verify the required parameter 'request' is set
234
+ if @api_client.config.client_side_validation && request.nil?
235
+ fail ArgumentError, "Missing the required parameter 'request' when calling TransformDocumentApi.transform_document_docx_table_fill_in_edit_session"
236
+ end
237
+ # resource path
238
+ local_var_path = '/convert/transform/docx/table/fill/data/edit-session'
239
+
240
+ # query parameters
241
+ query_params = {}
242
+
243
+ # header parameters
244
+ header_params = {}
245
+ # HTTP header 'Accept' (if needed)
246
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
247
+ # HTTP header 'Content-Type'
248
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
249
+
250
+ # form parameters
251
+ form_params = {}
252
+
253
+ # http body (model)
254
+ post_body = @api_client.object_to_http_body(request)
255
+ auth_names = ['Apikey']
256
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
257
+ :header_params => header_params,
258
+ :query_params => query_params,
259
+ :form_params => form_params,
260
+ :body => post_body,
261
+ :auth_names => auth_names,
262
+ :return_type => 'DocumentTransformEditSession')
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_table_fill_in_edit_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
265
+ end
266
+ return data, status_code, headers
267
+ end
268
+ # Fill in data in multiple tables in a Word DOCX document, return result
269
+ # Replace placeholder rows in multiple tables in an Office Word Document (docx) using one or more templates
270
+ # @param request
271
+ # @param [Hash] opts the optional parameters
272
+ # @return [String]
273
+ def transform_document_docx_table_fill_in_multi(request, opts = {})
274
+ data, _status_code, _headers = transform_document_docx_table_fill_in_multi_with_http_info(request, opts)
275
+ data
276
+ end
277
+
278
+ # Fill in data in multiple tables in a Word DOCX document, return result
279
+ # Replace placeholder rows in multiple tables in an Office Word Document (docx) using one or more templates
280
+ # @param request
281
+ # @param [Hash] opts the optional parameters
282
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
283
+ def transform_document_docx_table_fill_in_multi_with_http_info(request, opts = {})
284
+ if @api_client.config.debugging
285
+ @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_table_fill_in_multi ...'
286
+ end
287
+ # verify the required parameter 'request' is set
288
+ if @api_client.config.client_side_validation && request.nil?
289
+ fail ArgumentError, "Missing the required parameter 'request' when calling TransformDocumentApi.transform_document_docx_table_fill_in_multi"
290
+ end
291
+ # resource path
292
+ local_var_path = '/convert/transform/docx/table/fill/data/multi'
293
+
294
+ # query parameters
295
+ query_params = {}
296
+
297
+ # header parameters
298
+ header_params = {}
299
+ # HTTP header 'Accept' (if needed)
300
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
301
+ # HTTP header 'Content-Type'
302
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
303
+
304
+ # form parameters
305
+ form_params = {}
306
+
307
+ # http body (model)
308
+ post_body = @api_client.object_to_http_body(request)
309
+ auth_names = ['Apikey']
310
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
311
+ :header_params => header_params,
312
+ :query_params => query_params,
313
+ :form_params => form_params,
314
+ :body => post_body,
315
+ :auth_names => auth_names,
316
+ :return_type => 'String')
317
+ if @api_client.config.debugging
318
+ @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_table_fill_in_multi\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
319
+ end
320
+ return data, status_code, headers
321
+ end
322
+ # Replace string in PowerPoint PPTX presentation, return result
146
323
  # Replace all instances of a string in an Office PowerPoint Document (pptx)
147
324
  # @param match_string String to search for and match against, to be replaced
148
325
  # @param replace_string String to replace the matched values with
@@ -156,7 +333,7 @@ module CloudmersiveConvertApiClient
156
333
  data
157
334
  end
158
335
 
159
- # Replace string in PowerPoint PPTX presentation
336
+ # Replace string in PowerPoint PPTX presentation, return result
160
337
  # Replace all instances of a string in an Office PowerPoint Document (pptx)
161
338
  # @param match_string String to search for and match against, to be replaced
162
339
  # @param replace_string String to replace the matched values with
@@ -0,0 +1,196 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Active document editing session result. To retrieve the document, use the Finish Editing API.
17
+ class DocumentEditingEditSession
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Document editing session URL; in-memory temporary cache link with TTL (Time-to-Live expiration) of 30 minutes. To retrieve the document, use the Finish Editing API.
22
+ attr_accessor :edit_session_url
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'edit_session_url' => :'EditSessionURL'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'edit_session_url' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'Successful')
49
+ self.successful = attributes[:'Successful']
50
+ end
51
+
52
+ if attributes.has_key?(:'EditSessionURL')
53
+ self.edit_session_url = attributes[:'EditSessionURL']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ successful == o.successful &&
76
+ edit_session_url == o.edit_session_url
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [successful, edit_session_url].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end
@@ -0,0 +1,196 @@
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.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Active document editing session result. To retrieve the document, use the Finish Editing API.
17
+ class DocumentTransformEditSession
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Document editing session URL; in-memory temporary cache link with TTL (Time-to-Live expiration) of 30 minutes. To retrieve the document, use the Finish Editing API.
22
+ attr_accessor :edit_session_url
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'edit_session_url' => :'EditSessionURL'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'edit_session_url' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'Successful')
49
+ self.successful = attributes[:'Successful']
50
+ end
51
+
52
+ if attributes.has_key?(:'EditSessionURL')
53
+ self.edit_session_url = attributes[:'EditSessionURL']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ successful == o.successful &&
76
+ edit_session_url == o.edit_session_url
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [successful, edit_session_url].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end