cloudmersive-convert-api-client 1.2.3 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -0
  3. data/build.ps1 +12 -0
  4. data/client/Gemfile +7 -0
  5. data/client/README.md +184 -0
  6. data/client/Rakefile +8 -0
  7. data/client/cloudmersive-convert-api-client.gemspec +45 -0
  8. data/client/docs/CompareDocumentApi.md +66 -0
  9. data/client/docs/ConvertDataApi.md +118 -0
  10. data/client/docs/ConvertDocumentApi.md +723 -0
  11. data/client/docs/ConvertImageApi.md +69 -0
  12. data/client/docs/ConvertTemplateApi.md +63 -0
  13. data/client/docs/ConvertWebApi.md +283 -0
  14. data/client/docs/ConvertedPngPage.md +9 -0
  15. data/client/docs/DocumentValidationError.md +11 -0
  16. data/client/docs/DocumentValidationResult.md +11 -0
  17. data/client/docs/DocxFooter.md +9 -0
  18. data/client/docs/DocxHeader.md +9 -0
  19. data/client/docs/DocxInsertImageRequest.md +13 -0
  20. data/client/docs/DocxInsertImageResponse.md +9 -0
  21. data/client/docs/DocxParagraph.md +10 -0
  22. data/client/docs/DocxRun.md +14 -0
  23. data/client/docs/DocxSection.md +8 -0
  24. data/client/docs/DocxSetFooterRequest.md +10 -0
  25. data/client/docs/DocxSetFooterResponse.md +9 -0
  26. data/client/docs/DocxSetHeaderRequest.md +10 -0
  27. data/client/docs/DocxSetHeaderResponse.md +9 -0
  28. data/client/docs/DocxStyle.md +13 -0
  29. data/client/docs/DocxTable.md +45 -0
  30. data/client/docs/DocxTableCell.md +14 -0
  31. data/client/docs/DocxTableRow.md +9 -0
  32. data/client/docs/DocxText.md +9 -0
  33. data/client/docs/EditDocumentApi.md +668 -0
  34. data/client/docs/FinishEditingRequest.md +8 -0
  35. data/client/docs/GetDocxHeadersAndFootersRequest.md +9 -0
  36. data/client/docs/GetDocxHeadersAndFootersResponse.md +10 -0
  37. data/client/docs/GetDocxStylesRequest.md +9 -0
  38. data/client/docs/GetDocxStylesResponse.md +9 -0
  39. data/client/docs/GetDocxTablesRequest.md +9 -0
  40. data/client/docs/GetDocxTablesResponse.md +9 -0
  41. data/client/docs/HtmlMdResult.md +9 -0
  42. data/client/docs/HtmlTemplateApplicationRequest.md +10 -0
  43. data/client/docs/HtmlTemplateApplicationResponse.md +9 -0
  44. data/client/docs/HtmlTemplateOperation.md +10 -0
  45. data/client/docs/HtmlToOfficeRequest.md +8 -0
  46. data/client/docs/HtmlToPdfRequest.md +9 -0
  47. data/client/docs/InsertDocxTablesRequest.md +10 -0
  48. data/client/docs/InsertDocxTablesResponse.md +9 -0
  49. data/client/docs/MergeDocumentApi.md +182 -0
  50. data/client/docs/PdfToPngResult.md +9 -0
  51. data/client/docs/RemoveDocxHeadersAndFootersRequest.md +11 -0
  52. data/client/docs/RemoveDocxHeadersAndFootersResponse.md +9 -0
  53. data/client/docs/ReplaceStringRequest.md +12 -0
  54. data/client/docs/ScreenshotRequest.md +9 -0
  55. data/client/docs/ValidateDocumentApi.md +173 -0
  56. data/client/docs/ViewerResponse.md +9 -0
  57. data/client/docs/ViewerToolsApi.md +63 -0
  58. data/client/git_push.sh +55 -0
  59. data/client/lib/cloudmersive-convert-api-client.rb +89 -0
  60. data/client/lib/cloudmersive-convert-api-client/api/compare_document_api.rb +86 -0
  61. data/client/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +135 -0
  62. data/client/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +751 -0
  63. data/client/lib/cloudmersive-convert-api-client/api/convert_image_api.rb +91 -0
  64. data/client/lib/cloudmersive-convert-api-client/api/convert_template_api.rb +78 -0
  65. data/client/lib/cloudmersive-convert-api-client/api/convert_web_api.rb +299 -0
  66. data/client/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +684 -0
  67. data/client/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +212 -0
  68. data/client/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +191 -0
  69. data/client/lib/cloudmersive-convert-api-client/api/viewer_tools_api.rb +79 -0
  70. data/client/lib/cloudmersive-convert-api-client/api_client.rb +389 -0
  71. data/client/lib/cloudmersive-convert-api-client/api_error.rb +38 -0
  72. data/client/lib/cloudmersive-convert-api-client/configuration.rb +209 -0
  73. data/client/lib/cloudmersive-convert-api-client/models/converted_png_page.rb +199 -0
  74. data/client/lib/cloudmersive-convert-api-client/models/document_validation_error.rb +219 -0
  75. data/client/lib/cloudmersive-convert-api-client/models/document_validation_result.rb +221 -0
  76. data/client/lib/cloudmersive-convert-api-client/models/docx_footer.rb +203 -0
  77. data/client/lib/cloudmersive-convert-api-client/models/docx_header.rb +203 -0
  78. data/client/lib/cloudmersive-convert-api-client/models/docx_insert_image_request.rb +271 -0
  79. data/client/lib/cloudmersive-convert-api-client/models/docx_insert_image_response.rb +199 -0
  80. data/client/lib/cloudmersive-convert-api-client/models/docx_paragraph.rb +211 -0
  81. data/client/lib/cloudmersive-convert-api-client/models/docx_run.rb +251 -0
  82. data/client/lib/cloudmersive-convert-api-client/models/docx_section.rb +191 -0
  83. data/client/lib/cloudmersive-convert-api-client/models/docx_set_footer_request.rb +225 -0
  84. data/client/lib/cloudmersive-convert-api-client/models/docx_set_footer_response.rb +199 -0
  85. data/client/lib/cloudmersive-convert-api-client/models/docx_set_header_request.rb +225 -0
  86. data/client/lib/cloudmersive-convert-api-client/models/docx_set_header_response.rb +199 -0
  87. data/client/lib/cloudmersive-convert-api-client/models/docx_style.rb +239 -0
  88. data/client/lib/cloudmersive-convert-api-client/models/docx_table.rb +561 -0
  89. data/client/lib/cloudmersive-convert-api-client/models/docx_table_cell.rb +251 -0
  90. data/client/lib/cloudmersive-convert-api-client/models/docx_table_row.rb +201 -0
  91. data/client/lib/cloudmersive-convert-api-client/models/docx_text.rb +199 -0
  92. data/client/lib/cloudmersive-convert-api-client/models/finish_editing_request.rb +189 -0
  93. data/client/lib/cloudmersive-convert-api-client/models/get_docx_headers_and_footers_request.rb +215 -0
  94. data/client/lib/cloudmersive-convert-api-client/models/get_docx_headers_and_footers_response.rb +211 -0
  95. data/client/lib/cloudmersive-convert-api-client/models/get_docx_styles_request.rb +215 -0
  96. data/client/lib/cloudmersive-convert-api-client/models/get_docx_styles_response.rb +201 -0
  97. data/client/lib/cloudmersive-convert-api-client/models/get_docx_tables_request.rb +215 -0
  98. data/client/lib/cloudmersive-convert-api-client/models/get_docx_tables_response.rb +201 -0
  99. data/client/lib/cloudmersive-convert-api-client/models/html_md_result.rb +199 -0
  100. data/client/lib/cloudmersive-convert-api-client/models/html_template_application_request.rb +208 -0
  101. data/client/lib/cloudmersive-convert-api-client/models/html_template_application_response.rb +197 -0
  102. data/client/lib/cloudmersive-convert-api-client/models/html_template_operation.rb +239 -0
  103. data/client/lib/cloudmersive-convert-api-client/models/html_to_office_request.rb +188 -0
  104. data/client/lib/cloudmersive-convert-api-client/models/html_to_pdf_request.rb +197 -0
  105. data/client/lib/cloudmersive-convert-api-client/models/insert_docx_tables_request.rb +225 -0
  106. data/client/lib/cloudmersive-convert-api-client/models/insert_docx_tables_response.rb +199 -0
  107. data/client/lib/cloudmersive-convert-api-client/models/pdf_to_png_result.rb +201 -0
  108. data/client/lib/cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_request.rb +235 -0
  109. data/client/lib/cloudmersive-convert-api-client/models/remove_docx_headers_and_footers_response.rb +199 -0
  110. data/client/lib/cloudmersive-convert-api-client/models/replace_string_request.rb +245 -0
  111. data/client/lib/cloudmersive-convert-api-client/models/screenshot_request.rb +197 -0
  112. data/client/lib/cloudmersive-convert-api-client/models/viewer_response.rb +197 -0
  113. data/client/lib/cloudmersive-convert-api-client/version.rb +15 -0
  114. data/client/spec/api/compare_document_api_spec.rb +48 -0
  115. data/client/spec/api/convert_data_api_spec.rb +59 -0
  116. data/client/spec/api/convert_document_api_spec.rb +191 -0
  117. data/client/spec/api/convert_image_api_spec.rb +49 -0
  118. data/client/spec/api/convert_template_api_spec.rb +47 -0
  119. data/client/spec/api/convert_web_api_spec.rb +95 -0
  120. data/client/spec/api/edit_document_api_spec.rb +179 -0
  121. data/client/spec/api/merge_document_api_spec.rb +74 -0
  122. data/client/spec/api/validate_document_api_spec.rb +71 -0
  123. data/client/spec/api/viewer_tools_api_spec.rb +47 -0
  124. data/client/spec/api_client_spec.rb +226 -0
  125. data/client/spec/configuration_spec.rb +42 -0
  126. data/client/spec/models/converted_png_page_spec.rb +48 -0
  127. data/client/spec/models/document_validation_error_spec.rb +60 -0
  128. data/client/spec/models/document_validation_result_spec.rb +60 -0
  129. data/client/spec/models/docx_footer_spec.rb +48 -0
  130. data/client/spec/models/docx_header_spec.rb +48 -0
  131. data/client/spec/models/docx_insert_image_request_spec.rb +72 -0
  132. data/client/spec/models/docx_insert_image_response_spec.rb +48 -0
  133. data/client/spec/models/docx_paragraph_spec.rb +54 -0
  134. data/client/spec/models/docx_run_spec.rb +78 -0
  135. data/client/spec/models/docx_section_spec.rb +42 -0
  136. data/client/spec/models/docx_set_footer_request_spec.rb +54 -0
  137. data/client/spec/models/docx_set_footer_response_spec.rb +48 -0
  138. data/client/spec/models/docx_set_header_request_spec.rb +54 -0
  139. data/client/spec/models/docx_set_header_response_spec.rb +48 -0
  140. data/client/spec/models/docx_style_spec.rb +72 -0
  141. data/client/spec/models/docx_table_cell_spec.rb +78 -0
  142. data/client/spec/models/docx_table_row_spec.rb +48 -0
  143. data/client/spec/models/docx_table_spec.rb +264 -0
  144. data/client/spec/models/docx_text_spec.rb +48 -0
  145. data/client/spec/models/finish_editing_request_spec.rb +42 -0
  146. data/client/spec/models/get_docx_headers_and_footers_request_spec.rb +48 -0
  147. data/client/spec/models/get_docx_headers_and_footers_response_spec.rb +54 -0
  148. data/client/spec/models/get_docx_styles_request_spec.rb +48 -0
  149. data/client/spec/models/get_docx_styles_response_spec.rb +48 -0
  150. data/client/spec/models/get_docx_tables_request_spec.rb +48 -0
  151. data/client/spec/models/get_docx_tables_response_spec.rb +48 -0
  152. data/client/spec/models/html_md_result_spec.rb +48 -0
  153. data/client/spec/models/html_template_application_request_spec.rb +54 -0
  154. data/client/spec/models/html_template_application_response_spec.rb +48 -0
  155. data/client/spec/models/html_template_operation_spec.rb +58 -0
  156. data/client/spec/models/html_to_office_request_spec.rb +42 -0
  157. data/client/spec/models/html_to_pdf_request_spec.rb +48 -0
  158. data/client/spec/models/insert_docx_tables_request_spec.rb +54 -0
  159. data/client/spec/models/insert_docx_tables_response_spec.rb +48 -0
  160. data/client/spec/models/pdf_to_png_result_spec.rb +48 -0
  161. data/client/spec/models/remove_docx_headers_and_footers_request_spec.rb +60 -0
  162. data/client/spec/models/remove_docx_headers_and_footers_response_spec.rb +48 -0
  163. data/client/spec/models/replace_string_request_spec.rb +66 -0
  164. data/client/spec/models/screenshot_request_spec.rb +48 -0
  165. data/client/spec/models/viewer_response_spec.rb +48 -0
  166. data/client/spec/spec_helper.rb +111 -0
  167. data/cloudmersiveConvertApiClient-1.2.6.gem +0 -0
  168. data/cloudmersiveConvertApiClient-1.2.7.gem +0 -0
  169. data/packageconfig.json +11 -0
  170. data/swagger-codegen-cli.jar +0 -0
  171. metadata +173 -3
@@ -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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Footer in a Word Document (DOCX)
17
+ class DocxFooter
18
+ # Paragraphs in this footer
19
+ attr_accessor :paragraphs
20
+
21
+ # Sections that the footer is applied to
22
+ attr_accessor :sections_with_footer
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'paragraphs' => :'Paragraphs',
29
+ :'sections_with_footer' => :'SectionsWithFooter'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'paragraphs' => :'Array<DocxParagraph>',
37
+ :'sections_with_footer' => :'Array<DocxSection>'
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?(:'Paragraphs')
50
+ if (value = attributes[:'Paragraphs']).is_a?(Array)
51
+ self.paragraphs = value
52
+ end
53
+ end
54
+
55
+ if attributes.has_key?(:'SectionsWithFooter')
56
+ if (value = attributes[:'SectionsWithFooter']).is_a?(Array)
57
+ self.sections_with_footer = 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
+ paragraphs == o.paragraphs &&
82
+ sections_with_footer == o.sections_with_footer
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
+ [paragraphs, sections_with_footer].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,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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Header of a Word Document (DOCX)
17
+ class DocxHeader
18
+ # Paragraphs in this header
19
+ attr_accessor :paragraphs
20
+
21
+ # Sections that the header is applied to
22
+ attr_accessor :sections_with_header
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'paragraphs' => :'Paragraphs',
29
+ :'sections_with_header' => :'SectionsWithHeader'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'paragraphs' => :'Array<DocxParagraph>',
37
+ :'sections_with_header' => :'Array<DocxSection>'
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?(:'Paragraphs')
50
+ if (value = attributes[:'Paragraphs']).is_a?(Array)
51
+ self.paragraphs = value
52
+ end
53
+ end
54
+
55
+ if attributes.has_key?(:'SectionsWithHeader')
56
+ if (value = attributes[:'SectionsWithHeader']).is_a?(Array)
57
+ self.sections_with_header = 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
+ paragraphs == o.paragraphs &&
82
+ sections_with_header == o.sections_with_header
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
+ [paragraphs, sections_with_header].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,271 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # Input to set-footer command
17
+ class DocxInsertImageRequest
18
+ # Optional: Bytes of the input file to operate on
19
+ attr_accessor :input_document_file_bytes
20
+
21
+ # 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 to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
22
+ attr_accessor :input_document_file_url
23
+
24
+ # Optional: Bytes of the input image file to operate on
25
+ attr_accessor :input_image_file_bytes
26
+
27
+ # Optional: URL of an image file to operate on as input. This can be a public URL, or you can also use the begin-editing API to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
28
+ attr_accessor :input_image_file_url
29
+
30
+ # Width in points of the image, set to 0 for default
31
+ attr_accessor :image_width
32
+
33
+ # Height in point of the image, set to 0 for default
34
+ attr_accessor :image_height
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'input_document_file_bytes' => :'InputDocumentFileBytes',
41
+ :'input_document_file_url' => :'InputDocumentFileUrl',
42
+ :'input_image_file_bytes' => :'InputImageFileBytes',
43
+ :'input_image_file_url' => :'InputImageFileUrl',
44
+ :'image_width' => :'ImageWidth',
45
+ :'image_height' => :'ImageHeight'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'input_document_file_bytes' => :'String',
53
+ :'input_document_file_url' => :'String',
54
+ :'input_image_file_bytes' => :'String',
55
+ :'input_image_file_url' => :'String',
56
+ :'image_width' => :'Integer',
57
+ :'image_height' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
+
69
+ if attributes.has_key?(:'InputDocumentFileBytes')
70
+ self.input_document_file_bytes = attributes[:'InputDocumentFileBytes']
71
+ end
72
+
73
+ if attributes.has_key?(:'InputDocumentFileUrl')
74
+ self.input_document_file_url = attributes[:'InputDocumentFileUrl']
75
+ end
76
+
77
+ if attributes.has_key?(:'InputImageFileBytes')
78
+ self.input_image_file_bytes = attributes[:'InputImageFileBytes']
79
+ end
80
+
81
+ if attributes.has_key?(:'InputImageFileUrl')
82
+ self.input_image_file_url = attributes[:'InputImageFileUrl']
83
+ end
84
+
85
+ if attributes.has_key?(:'ImageWidth')
86
+ self.image_width = attributes[:'ImageWidth']
87
+ end
88
+
89
+ if attributes.has_key?(:'ImageHeight')
90
+ self.image_height = attributes[:'ImageHeight']
91
+ end
92
+
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if !@input_document_file_bytes.nil? && @input_document_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
100
+ invalid_properties.push("invalid value for 'input_document_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
101
+ end
102
+
103
+ if !@input_image_file_bytes.nil? && @input_image_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
104
+ invalid_properties.push("invalid value for 'input_image_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
105
+ end
106
+
107
+ return invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if !@input_document_file_bytes.nil? && @input_document_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
114
+ return false if !@input_image_file_bytes.nil? && @input_image_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
115
+ return true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] input_document_file_bytes Value to be assigned
120
+ def input_document_file_bytes=(input_document_file_bytes)
121
+
122
+ if !input_document_file_bytes.nil? && input_document_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
123
+ fail ArgumentError, "invalid value for 'input_document_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
124
+ end
125
+
126
+ @input_document_file_bytes = input_document_file_bytes
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] input_image_file_bytes Value to be assigned
131
+ def input_image_file_bytes=(input_image_file_bytes)
132
+
133
+ if !input_image_file_bytes.nil? && input_image_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
134
+ fail ArgumentError, "invalid value for 'input_image_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
135
+ end
136
+
137
+ @input_image_file_bytes = input_image_file_bytes
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ input_document_file_bytes == o.input_document_file_bytes &&
146
+ input_document_file_url == o.input_document_file_url &&
147
+ input_image_file_bytes == o.input_image_file_bytes &&
148
+ input_image_file_url == o.input_image_file_url &&
149
+ image_width == o.image_width &&
150
+ image_height == o.image_height
151
+ end
152
+
153
+ # @see the `==` method
154
+ # @param [Object] Object to be compared
155
+ def eql?(o)
156
+ self == o
157
+ end
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Fixnum] Hash code
161
+ def hash
162
+ [input_document_file_bytes, input_document_file_url, input_image_file_bytes, input_image_file_url, image_width, image_height].hash
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ self.class.swagger_types.each_pair do |key, type|
171
+ if type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :DateTime
192
+ DateTime.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :BOOLEAN
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
223
+ temp_model.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ next if value.nil?
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map{ |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end