cloudmersive-convert-api-client 2.1.1 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -4
  3. data/docs/DocxMetadataCustomProperty.md +13 -0
  4. data/docs/DocxSetCustomMetadataPropertiesRequest.md +10 -0
  5. data/docs/EditDocumentApi.md +275 -0
  6. data/docs/EditHtmlApi.md +60 -0
  7. data/docs/GetDocxMetadataPropertiesResponse.md +16 -0
  8. data/docs/GetMacrosResponse.md +9 -0
  9. data/docs/HtmlGetLinksResponse.md +9 -0
  10. data/docs/HtmlHyperlink.md +9 -0
  11. data/docs/HtmlSsrfThreatCheckResult.md +10 -0
  12. data/docs/HtmlThreatLink.md +9 -0
  13. data/docs/MergeDocumentApi.md +134 -0
  14. data/docs/ValidateDocumentApi.md +220 -0
  15. data/docs/ViewerToolsApi.md +8 -2
  16. data/lib/cloudmersive-convert-api-client.rb +8 -0
  17. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +274 -0
  18. data/lib/cloudmersive-convert-api-client/api/edit_html_api.rb +55 -0
  19. data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +148 -0
  20. data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +220 -0
  21. data/lib/cloudmersive-convert-api-client/api/viewer_tools_api.rb +6 -0
  22. data/lib/cloudmersive-convert-api-client/models/docx_metadata_custom_property.rb +236 -0
  23. data/lib/cloudmersive-convert-api-client/models/docx_set_custom_metadata_properties_request.rb +223 -0
  24. data/lib/cloudmersive-convert-api-client/models/get_docx_metadata_properties_response.rb +268 -0
  25. data/lib/cloudmersive-convert-api-client/models/get_macros_response.rb +196 -0
  26. data/lib/cloudmersive-convert-api-client/models/html_get_links_response.rb +198 -0
  27. data/lib/cloudmersive-convert-api-client/models/html_hyperlink.rb +196 -0
  28. data/lib/cloudmersive-convert-api-client/models/html_ssrf_threat_check_result.rb +208 -0
  29. data/lib/cloudmersive-convert-api-client/models/html_threat_link.rb +196 -0
  30. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  31. data/spec/api/edit_document_api_spec.rb +60 -0
  32. data/spec/api/edit_html_api_spec.rb +14 -0
  33. data/spec/api/merge_document_api_spec.rb +34 -0
  34. data/spec/api/validate_document_api_spec.rb +48 -0
  35. data/spec/api/viewer_tools_api_spec.rb +2 -0
  36. data/spec/models/docx_metadata_custom_property_spec.rb +71 -0
  37. data/spec/models/docx_set_custom_metadata_properties_request_spec.rb +53 -0
  38. data/spec/models/get_docx_metadata_properties_response_spec.rb +89 -0
  39. data/spec/models/get_macros_response_spec.rb +47 -0
  40. data/spec/models/html_get_links_response_spec.rb +47 -0
  41. data/spec/models/html_hyperlink_spec.rb +47 -0
  42. data/spec/models/html_ssrf_threat_check_result_spec.rb +53 -0
  43. data/spec/models/html_threat_link_spec.rb +47 -0
  44. metadata +26 -2
@@ -349,6 +349,61 @@ module CloudmersiveConvertApiClient
349
349
  end
350
350
  return data, status_code, headers
351
351
  end
352
+ # Validate an HTML file and checks for SSRF threats
353
+ # Validate an HTML document file and checks for SSRF (Server-side Request Forgery) threats in the file; if the document is not valid, identifies the errors in the document
354
+ # @param input_file Input file to perform the operation on.
355
+ # @param [Hash] opts the optional parameters
356
+ # @return [HtmlSsrfThreatCheckResult]
357
+ def validate_document_html_ssrf_validation(input_file, opts = {})
358
+ data, _status_code, _headers = validate_document_html_ssrf_validation_with_http_info(input_file, opts)
359
+ data
360
+ end
361
+
362
+ # Validate an HTML file and checks for SSRF threats
363
+ # Validate an HTML document file and checks for SSRF (Server-side Request Forgery) threats in the file; if the document is not valid, identifies the errors in the document
364
+ # @param input_file Input file to perform the operation on.
365
+ # @param [Hash] opts the optional parameters
366
+ # @return [Array<(HtmlSsrfThreatCheckResult, Fixnum, Hash)>] HtmlSsrfThreatCheckResult data, response status code and response headers
367
+ def validate_document_html_ssrf_validation_with_http_info(input_file, opts = {})
368
+ if @api_client.config.debugging
369
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_html_ssrf_validation ...'
370
+ end
371
+ # verify the required parameter 'input_file' is set
372
+ if @api_client.config.client_side_validation && input_file.nil?
373
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_html_ssrf_validation"
374
+ end
375
+ # resource path
376
+ local_var_path = '/convert/validate/html/ssrf-threat-check'
377
+
378
+ # query parameters
379
+ query_params = {}
380
+
381
+ # header parameters
382
+ header_params = {}
383
+ # HTTP header 'Accept' (if needed)
384
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
385
+ # HTTP header 'Content-Type'
386
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
387
+
388
+ # form parameters
389
+ form_params = {}
390
+ form_params['inputFile'] = input_file
391
+
392
+ # http body (model)
393
+ post_body = nil
394
+ auth_names = ['Apikey']
395
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
396
+ :header_params => header_params,
397
+ :query_params => query_params,
398
+ :form_params => form_params,
399
+ :body => post_body,
400
+ :auth_names => auth_names,
401
+ :return_type => 'HtmlSsrfThreatCheckResult')
402
+ if @api_client.config.debugging
403
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_html_ssrf_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
404
+ end
405
+ return data, status_code, headers
406
+ end
352
407
  # Validate an HTML file
353
408
  # Validate an HTML document file; if the document is not valid, identifies the errors in the document
354
409
  # @param input_file Input file to perform the operation on.
@@ -459,6 +514,61 @@ module CloudmersiveConvertApiClient
459
514
  end
460
515
  return data, status_code, headers
461
516
  end
517
+ # Validate a JPG File
518
+ # Validate a JPEG image file; if the document is not valid, identifies the errors in the document..
519
+ # @param input_file Input file to perform the operation on.
520
+ # @param [Hash] opts the optional parameters
521
+ # @return [DocumentValidationResult]
522
+ def validate_document_jpg_validation(input_file, opts = {})
523
+ data, _status_code, _headers = validate_document_jpg_validation_with_http_info(input_file, opts)
524
+ data
525
+ end
526
+
527
+ # Validate a JPG File
528
+ # Validate a JPEG image file; if the document is not valid, identifies the errors in the document..
529
+ # @param input_file Input file to perform the operation on.
530
+ # @param [Hash] opts the optional parameters
531
+ # @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
532
+ def validate_document_jpg_validation_with_http_info(input_file, opts = {})
533
+ if @api_client.config.debugging
534
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_jpg_validation ...'
535
+ end
536
+ # verify the required parameter 'input_file' is set
537
+ if @api_client.config.client_side_validation && input_file.nil?
538
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_jpg_validation"
539
+ end
540
+ # resource path
541
+ local_var_path = '/convert/validate/jpg'
542
+
543
+ # query parameters
544
+ query_params = {}
545
+
546
+ # header parameters
547
+ header_params = {}
548
+ # HTTP header 'Accept' (if needed)
549
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
550
+ # HTTP header 'Content-Type'
551
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
552
+
553
+ # form parameters
554
+ form_params = {}
555
+ form_params['inputFile'] = input_file
556
+
557
+ # http body (model)
558
+ post_body = nil
559
+ auth_names = ['Apikey']
560
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
561
+ :header_params => header_params,
562
+ :query_params => query_params,
563
+ :form_params => form_params,
564
+ :body => post_body,
565
+ :auth_names => auth_names,
566
+ :return_type => 'DocumentValidationResult')
567
+ if @api_client.config.debugging
568
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_jpg_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
569
+ end
570
+ return data, status_code, headers
571
+ end
462
572
  # Validate a JSON file
463
573
  # Validate a JSON (JavaScript Object Notation) document file; if the document is not valid, identifies the errors in the document
464
574
  # @param input_file Input file to perform the operation on.
@@ -624,6 +734,61 @@ module CloudmersiveConvertApiClient
624
734
  end
625
735
  return data, status_code, headers
626
736
  end
737
+ # Validate a PNG File
738
+ # Validate a PNG image file; if the document is not valid, identifies the errors in the document.
739
+ # @param input_file Input file to perform the operation on.
740
+ # @param [Hash] opts the optional parameters
741
+ # @return [DocumentValidationResult]
742
+ def validate_document_png_validation(input_file, opts = {})
743
+ data, _status_code, _headers = validate_document_png_validation_with_http_info(input_file, opts)
744
+ data
745
+ end
746
+
747
+ # Validate a PNG File
748
+ # Validate a PNG image file; if the document is not valid, identifies the errors in the document.
749
+ # @param input_file Input file to perform the operation on.
750
+ # @param [Hash] opts the optional parameters
751
+ # @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
752
+ def validate_document_png_validation_with_http_info(input_file, opts = {})
753
+ if @api_client.config.debugging
754
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_png_validation ...'
755
+ end
756
+ # verify the required parameter 'input_file' is set
757
+ if @api_client.config.client_side_validation && input_file.nil?
758
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_png_validation"
759
+ end
760
+ # resource path
761
+ local_var_path = '/convert/validate/png'
762
+
763
+ # query parameters
764
+ query_params = {}
765
+
766
+ # header parameters
767
+ header_params = {}
768
+ # HTTP header 'Accept' (if needed)
769
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
770
+ # HTTP header 'Content-Type'
771
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
772
+
773
+ # form parameters
774
+ form_params = {}
775
+ form_params['inputFile'] = input_file
776
+
777
+ # http body (model)
778
+ post_body = nil
779
+ auth_names = ['Apikey']
780
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
781
+ :header_params => header_params,
782
+ :query_params => query_params,
783
+ :form_params => form_params,
784
+ :body => post_body,
785
+ :auth_names => auth_names,
786
+ :return_type => 'DocumentValidationResult')
787
+ if @api_client.config.debugging
788
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_png_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
789
+ end
790
+ return data, status_code, headers
791
+ end
627
792
  # Validate a PowerPoint presentation (PPTX)
628
793
  # Validate a PowerPoint presentation (PPTX); if the document is not valid, identifies the errors in the document
629
794
  # @param input_file Input file to perform the operation on.
@@ -789,6 +954,61 @@ module CloudmersiveConvertApiClient
789
954
  end
790
955
  return data, status_code, headers
791
956
  end
957
+ # Validate an TXT file
958
+ # Validate an TXT document file; if the document is not valid, identifies the errors in the document
959
+ # @param input_file Input file to perform the operation on.
960
+ # @param [Hash] opts the optional parameters
961
+ # @return [DocumentValidationResult]
962
+ def validate_document_txt_validation(input_file, opts = {})
963
+ data, _status_code, _headers = validate_document_txt_validation_with_http_info(input_file, opts)
964
+ data
965
+ end
966
+
967
+ # Validate an TXT file
968
+ # Validate an TXT document file; if the document is not valid, identifies the errors in the document
969
+ # @param input_file Input file to perform the operation on.
970
+ # @param [Hash] opts the optional parameters
971
+ # @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
972
+ def validate_document_txt_validation_with_http_info(input_file, opts = {})
973
+ if @api_client.config.debugging
974
+ @api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_txt_validation ...'
975
+ end
976
+ # verify the required parameter 'input_file' is set
977
+ if @api_client.config.client_side_validation && input_file.nil?
978
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_txt_validation"
979
+ end
980
+ # resource path
981
+ local_var_path = '/convert/validate/txt'
982
+
983
+ # query parameters
984
+ query_params = {}
985
+
986
+ # header parameters
987
+ header_params = {}
988
+ # HTTP header 'Accept' (if needed)
989
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
990
+ # HTTP header 'Content-Type'
991
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
992
+
993
+ # form parameters
994
+ form_params = {}
995
+ form_params['inputFile'] = input_file
996
+
997
+ # http body (model)
998
+ post_body = nil
999
+ auth_names = ['Apikey']
1000
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1001
+ :header_params => header_params,
1002
+ :query_params => query_params,
1003
+ :form_params => form_params,
1004
+ :body => post_body,
1005
+ :auth_names => auth_names,
1006
+ :return_type => 'DocumentValidationResult')
1007
+ if @api_client.config.debugging
1008
+ @api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_txt_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1009
+ end
1010
+ return data, status_code, headers
1011
+ end
792
1012
  # Validate a Excel document (XLSX)
793
1013
  # Validate a Excel document (XLSX); if the document is not valid, identifies the errors in the document
794
1014
  # @param input_file Input file to perform the operation on.
@@ -23,6 +23,8 @@ module CloudmersiveConvertApiClient
23
23
  # Creates an HTML embed code for a simple web-based viewer of a document; supports Office document types and PDF.
24
24
  # @param input_file Input file to perform the operation on.
25
25
  # @param [Hash] opts the optional parameters
26
+ # @option opts [Integer] :width Optional; width of the output viewer in pixels
27
+ # @option opts [Integer] :height Optional; height of the output viewer in pixels
26
28
  # @return [ViewerResponse]
27
29
  def viewer_tools_create_simple(input_file, opts = {})
28
30
  data, _status_code, _headers = viewer_tools_create_simple_with_http_info(input_file, opts)
@@ -33,6 +35,8 @@ module CloudmersiveConvertApiClient
33
35
  # Creates an HTML embed code for a simple web-based viewer of a document; supports Office document types and PDF.
34
36
  # @param input_file Input file to perform the operation on.
35
37
  # @param [Hash] opts the optional parameters
38
+ # @option opts [Integer] :width Optional; width of the output viewer in pixels
39
+ # @option opts [Integer] :height Optional; height of the output viewer in pixels
36
40
  # @return [Array<(ViewerResponse, Fixnum, Hash)>] ViewerResponse data, response status code and response headers
37
41
  def viewer_tools_create_simple_with_http_info(input_file, opts = {})
38
42
  if @api_client.config.debugging
@@ -54,6 +58,8 @@ module CloudmersiveConvertApiClient
54
58
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
55
59
  # HTTP header 'Content-Type'
56
60
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
61
+ header_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
62
+ header_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
57
63
 
58
64
  # form parameters
59
65
  form_params = {}
@@ -0,0 +1,236 @@
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
+ # Name and value pair for a custom-defined DOCX metadata property
17
+ class DocxMetadataCustomProperty
18
+ # Name of the property
19
+ attr_accessor :property_name
20
+
21
+ # Data type of the property; possible values are \"string\", \"integer\", \"double\" or \"date\"
22
+ attr_accessor :property_data_type
23
+
24
+ # If the property is of a string data type, then provides the string value if available
25
+ attr_accessor :string_value
26
+
27
+ # If the property is of a integer data type, then provides the integer value if available
28
+ attr_accessor :integer_value
29
+
30
+ # If the property is of a double floating point data type, then provides the double value if available
31
+ attr_accessor :double_value
32
+
33
+ # If the property is of a date time data type, then provides the date time value if available
34
+ attr_accessor :date_value
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'property_name' => :'PropertyName',
40
+ :'property_data_type' => :'PropertyDataType',
41
+ :'string_value' => :'StringValue',
42
+ :'integer_value' => :'IntegerValue',
43
+ :'double_value' => :'DoubleValue',
44
+ :'date_value' => :'DateValue'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'property_name' => :'String',
52
+ :'property_data_type' => :'String',
53
+ :'string_value' => :'String',
54
+ :'integer_value' => :'Integer',
55
+ :'double_value' => :'Float',
56
+ :'date_value' => :'DateTime'
57
+ }
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
67
+
68
+ if attributes.has_key?(:'PropertyName')
69
+ self.property_name = attributes[:'PropertyName']
70
+ end
71
+
72
+ if attributes.has_key?(:'PropertyDataType')
73
+ self.property_data_type = attributes[:'PropertyDataType']
74
+ end
75
+
76
+ if attributes.has_key?(:'StringValue')
77
+ self.string_value = attributes[:'StringValue']
78
+ end
79
+
80
+ if attributes.has_key?(:'IntegerValue')
81
+ self.integer_value = attributes[:'IntegerValue']
82
+ end
83
+
84
+ if attributes.has_key?(:'DoubleValue')
85
+ self.double_value = attributes[:'DoubleValue']
86
+ end
87
+
88
+ if attributes.has_key?(:'DateValue')
89
+ self.date_value = attributes[:'DateValue']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ property_name == o.property_name &&
112
+ property_data_type == o.property_data_type &&
113
+ string_value == o.string_value &&
114
+ integer_value == o.integer_value &&
115
+ double_value == o.double_value &&
116
+ date_value == o.date_value
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [property_name, property_data_type, string_value, integer_value, double_value, date_value].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ end