cloudmersive-convert-api-client 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -4
  3. data/docs/CreateBlankDocxRequest.md +8 -0
  4. data/docs/CreateBlankDocxResponse.md +9 -0
  5. data/docs/CreateBlankSpreadsheetRequest.md +8 -0
  6. data/docs/CreateBlankSpreadsheetResponse.md +9 -0
  7. data/docs/EditDocumentApi.md +165 -0
  8. data/docs/GetXlsxWorksheetsResponse.md +1 -1
  9. data/docs/UpdateDocxTableCellRequest.md +13 -0
  10. data/docs/UpdateDocxTableCellResponse.md +9 -0
  11. data/docs/UpdateDocxTableRowRequest.md +1 -1
  12. data/lib/cloudmersive-convert-api-client.rb +6 -0
  13. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +165 -0
  14. data/lib/cloudmersive-convert-api-client/models/create_blank_docx_request.rb +189 -0
  15. data/lib/cloudmersive-convert-api-client/models/create_blank_docx_response.rb +199 -0
  16. data/lib/cloudmersive-convert-api-client/models/create_blank_spreadsheet_request.rb +189 -0
  17. data/lib/cloudmersive-convert-api-client/models/create_blank_spreadsheet_response.rb +199 -0
  18. data/lib/cloudmersive-convert-api-client/models/get_xlsx_worksheets_response.rb +1 -1
  19. data/lib/cloudmersive-convert-api-client/models/update_docx_table_cell_request.rb +255 -0
  20. data/lib/cloudmersive-convert-api-client/models/update_docx_table_cell_response.rb +199 -0
  21. data/lib/cloudmersive-convert-api-client/models/update_docx_table_row_request.rb +7 -7
  22. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  23. data/spec/api/edit_document_api_spec.rb +36 -0
  24. data/spec/models/create_blank_docx_request_spec.rb +42 -0
  25. data/spec/models/create_blank_docx_response_spec.rb +48 -0
  26. data/spec/models/create_blank_spreadsheet_request_spec.rb +42 -0
  27. data/spec/models/create_blank_spreadsheet_response_spec.rb +48 -0
  28. data/spec/models/update_docx_table_cell_request_spec.rb +72 -0
  29. data/spec/models/update_docx_table_cell_response_spec.rb +48 -0
  30. data/spec/models/update_docx_table_row_request_spec.rb +1 -1
  31. metadata +19 -1
@@ -0,0 +1,199 @@
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
+ # Result of creating a blank worksheet
17
+ class CreateBlankSpreadsheetResponse
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # URL to the edited XLSX file; file is stored in an in-memory cache and will be deleted. Call Finish-Editing to get the result document contents.
22
+ attr_accessor :edited_document_url
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'successful' => :'Successful',
29
+ :'edited_document_url' => :'EditedDocumentURL'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'successful' => :'BOOLEAN',
37
+ :'edited_document_url' => :'String'
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?(:'Successful')
50
+ self.successful = attributes[:'Successful']
51
+ end
52
+
53
+ if attributes.has_key?(:'EditedDocumentURL')
54
+ self.edited_document_url = attributes[:'EditedDocumentURL']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ successful == o.successful &&
78
+ edited_document_url == o.edited_document_url
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [successful, edited_document_url].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map{ |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -18,7 +18,7 @@ module CloudmersiveConvertApiClient
18
18
  # True if successful, false otherwise
19
19
  attr_accessor :successful
20
20
 
21
- # Styles in the DOCX document
21
+ # Worksheets in the Excel XLSX spreadsheet
22
22
  attr_accessor :worksheets
23
23
 
24
24
 
@@ -0,0 +1,255 @@
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
+ # Input to a Update Table Cell request
17
+ class UpdateDocxTableCellRequest
18
+ # Optional: Bytes of the input file to operate on
19
+ attr_accessor :input_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_file_url
23
+
24
+ # Table cell contents you would like to update the cell with
25
+ attr_accessor :cell_to_update
26
+
27
+ # 0-based index of the Table Row to update
28
+ attr_accessor :table_row_index
29
+
30
+ # 0-based index of the Table Cell (within the row) to update
31
+ attr_accessor :table_cell_index
32
+
33
+ # Required; the path to the existing table to modify
34
+ attr_accessor :existing_table_path
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'input_file_bytes' => :'InputFileBytes',
41
+ :'input_file_url' => :'InputFileUrl',
42
+ :'cell_to_update' => :'CellToUpdate',
43
+ :'table_row_index' => :'TableRowIndex',
44
+ :'table_cell_index' => :'TableCellIndex',
45
+ :'existing_table_path' => :'ExistingTablePath'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'input_file_bytes' => :'String',
53
+ :'input_file_url' => :'String',
54
+ :'cell_to_update' => :'DocxTableCell',
55
+ :'table_row_index' => :'Integer',
56
+ :'table_cell_index' => :'Integer',
57
+ :'existing_table_path' => :'String'
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?(:'InputFileBytes')
70
+ self.input_file_bytes = attributes[:'InputFileBytes']
71
+ end
72
+
73
+ if attributes.has_key?(:'InputFileUrl')
74
+ self.input_file_url = attributes[:'InputFileUrl']
75
+ end
76
+
77
+ if attributes.has_key?(:'CellToUpdate')
78
+ self.cell_to_update = attributes[:'CellToUpdate']
79
+ end
80
+
81
+ if attributes.has_key?(:'TableRowIndex')
82
+ self.table_row_index = attributes[:'TableRowIndex']
83
+ end
84
+
85
+ if attributes.has_key?(:'TableCellIndex')
86
+ self.table_cell_index = attributes[:'TableCellIndex']
87
+ end
88
+
89
+ if attributes.has_key?(:'ExistingTablePath')
90
+ self.existing_table_path = attributes[:'ExistingTablePath']
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_file_bytes.nil? && @input_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_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
+ return invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
110
+ return true
111
+ end
112
+
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] input_file_bytes Value to be assigned
115
+ def input_file_bytes=(input_file_bytes)
116
+
117
+ if !input_file_bytes.nil? && input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
118
+ fail ArgumentError, "invalid value for 'input_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
119
+ end
120
+
121
+ @input_file_bytes = input_file_bytes
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ input_file_bytes == o.input_file_bytes &&
130
+ input_file_url == o.input_file_url &&
131
+ cell_to_update == o.cell_to_update &&
132
+ table_row_index == o.table_row_index &&
133
+ table_cell_index == o.table_cell_index &&
134
+ existing_table_path == o.existing_table_path
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Fixnum] Hash code
145
+ def hash
146
+ [input_file_bytes, input_file_url, cell_to_update, table_row_index, table_cell_index, existing_table_path].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.swagger_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :DateTime
176
+ DateTime.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :BOOLEAN
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
207
+ temp_model.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ next if value.nil?
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map{ |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+
255
+ end