cloudmersive-convert-api-client 1.6.5 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -4
  3. data/docs/DocxComment.md +16 -0
  4. data/docs/DocxInsertCommentOnParagraphRequest.md +11 -0
  5. data/docs/DocxTopLevelComment.md +14 -0
  6. data/docs/EditDocumentApi.md +165 -0
  7. data/docs/GetDocxCommentsHierarchicalResponse.md +10 -0
  8. data/docs/GetDocxCommentsResponse.md +10 -0
  9. data/docs/GetDocxGetCommentsHierarchicalRequest.md +9 -0
  10. data/docs/GetDocxGetCommentsRequest.md +9 -0
  11. data/docs/GetDocxPagesResponse.md +3 -3
  12. data/docs/InsertDocxCommentOnParagraphResponse.md +9 -0
  13. data/lib/cloudmersive-convert-api-client.rb +8 -0
  14. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +165 -0
  15. data/lib/cloudmersive-convert-api-client/models/docx_comment.rb +269 -0
  16. data/lib/cloudmersive-convert-api-client/models/docx_insert_comment_on_paragraph_request.rb +235 -0
  17. data/lib/cloudmersive-convert-api-client/models/docx_page.rb +1 -1
  18. data/lib/cloudmersive-convert-api-client/models/docx_top_level_comment.rb +251 -0
  19. data/lib/cloudmersive-convert-api-client/models/get_docx_comments_hierarchical_response.rb +211 -0
  20. data/lib/cloudmersive-convert-api-client/models/get_docx_comments_response.rb +211 -0
  21. data/lib/cloudmersive-convert-api-client/models/get_docx_get_comments_hierarchical_request.rb +215 -0
  22. data/lib/cloudmersive-convert-api-client/models/get_docx_get_comments_request.rb +215 -0
  23. data/lib/cloudmersive-convert-api-client/models/get_docx_pages_response.rb +4 -1
  24. data/lib/cloudmersive-convert-api-client/models/insert_docx_comment_on_paragraph_response.rb +199 -0
  25. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  26. data/spec/api/edit_document_api_spec.rb +36 -0
  27. data/spec/models/docx_comment_spec.rb +90 -0
  28. data/spec/models/docx_insert_comment_on_paragraph_request_spec.rb +60 -0
  29. data/spec/models/docx_top_level_comment_spec.rb +78 -0
  30. data/spec/models/get_docx_comments_hierarchical_response_spec.rb +54 -0
  31. data/spec/models/get_docx_comments_response_spec.rb +54 -0
  32. data/spec/models/get_docx_get_comments_hierarchical_request_spec.rb +48 -0
  33. data/spec/models/get_docx_get_comments_request_spec.rb +48 -0
  34. data/spec/models/insert_docx_comment_on_paragraph_response_spec.rb +48 -0
  35. metadata +26 -2
@@ -0,0 +1,269 @@
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
+ # Comment in a Word Document
17
+ class DocxComment
18
+ # Path to the comment in the document
19
+ attr_accessor :path
20
+
21
+ # Author name of the comment
22
+ attr_accessor :author
23
+
24
+ # Initials of the author of the comment
25
+ attr_accessor :author_initials
26
+
27
+ # Text content of the comment
28
+ attr_accessor :comment_text
29
+
30
+ # Date timestamp of the comment
31
+ attr_accessor :comment_date
32
+
33
+ # True if the comment is at the top level, false if this comment is a child reply of another comment
34
+ attr_accessor :is_top_level
35
+
36
+ # True if this comment is a reply to another comment, false otherwise
37
+ attr_accessor :is_reply
38
+
39
+ # Path to the parent of this comment, if this comment is a reply, otherwise this value will be null
40
+ attr_accessor :parent_comment_path
41
+
42
+ # True if this comment is marked as Done in Word, otherwise it is false
43
+ attr_accessor :done
44
+
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'path' => :'Path',
50
+ :'author' => :'Author',
51
+ :'author_initials' => :'AuthorInitials',
52
+ :'comment_text' => :'CommentText',
53
+ :'comment_date' => :'CommentDate',
54
+ :'is_top_level' => :'IsTopLevel',
55
+ :'is_reply' => :'IsReply',
56
+ :'parent_comment_path' => :'ParentCommentPath',
57
+ :'done' => :'Done'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ :'path' => :'String',
65
+ :'author' => :'String',
66
+ :'author_initials' => :'String',
67
+ :'comment_text' => :'String',
68
+ :'comment_date' => :'DateTime',
69
+ :'is_top_level' => :'BOOLEAN',
70
+ :'is_reply' => :'BOOLEAN',
71
+ :'parent_comment_path' => :'String',
72
+ :'done' => :'BOOLEAN'
73
+ }
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ return unless attributes.is_a?(Hash)
80
+
81
+ # convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
83
+
84
+ if attributes.has_key?(:'Path')
85
+ self.path = attributes[:'Path']
86
+ end
87
+
88
+ if attributes.has_key?(:'Author')
89
+ self.author = attributes[:'Author']
90
+ end
91
+
92
+ if attributes.has_key?(:'AuthorInitials')
93
+ self.author_initials = attributes[:'AuthorInitials']
94
+ end
95
+
96
+ if attributes.has_key?(:'CommentText')
97
+ self.comment_text = attributes[:'CommentText']
98
+ end
99
+
100
+ if attributes.has_key?(:'CommentDate')
101
+ self.comment_date = attributes[:'CommentDate']
102
+ end
103
+
104
+ if attributes.has_key?(:'IsTopLevel')
105
+ self.is_top_level = attributes[:'IsTopLevel']
106
+ end
107
+
108
+ if attributes.has_key?(:'IsReply')
109
+ self.is_reply = attributes[:'IsReply']
110
+ end
111
+
112
+ if attributes.has_key?(:'ParentCommentPath')
113
+ self.parent_comment_path = attributes[:'ParentCommentPath']
114
+ end
115
+
116
+ if attributes.has_key?(:'Done')
117
+ self.done = attributes[:'Done']
118
+ end
119
+
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ return invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ return true
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ path == o.path &&
141
+ author == o.author &&
142
+ author_initials == o.author_initials &&
143
+ comment_text == o.comment_text &&
144
+ comment_date == o.comment_date &&
145
+ is_top_level == o.is_top_level &&
146
+ is_reply == o.is_reply &&
147
+ parent_comment_path == o.parent_comment_path &&
148
+ done == o.done
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Fixnum] Hash code
159
+ def hash
160
+ [path, author, author_initials, comment_text, comment_date, is_top_level, is_reply, parent_comment_path, done].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.swagger_types.each_pair do |key, type|
169
+ if type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :DateTime
190
+ DateTime.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :BOOLEAN
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
221
+ temp_model.build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ next if value.nil?
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map{ |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+
267
+ end
268
+
269
+ end
@@ -0,0 +1,235 @@
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 Insert Comment on Paragraph request
17
+ class DocxInsertCommentOnParagraphRequest
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
+ # Path to the paragraph to attach the comment to. You can get the Path by retrieving all of the Paragraphs in document by calling Get Body and taking the Path property of the desired paragraph to add the comment to.
25
+ attr_accessor :paragraph_path
26
+
27
+ # Comment to insert
28
+ attr_accessor :comment_to_insert
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'input_file_bytes' => :'InputFileBytes',
35
+ :'input_file_url' => :'InputFileUrl',
36
+ :'paragraph_path' => :'ParagraphPath',
37
+ :'comment_to_insert' => :'CommentToInsert'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'input_file_bytes' => :'String',
45
+ :'input_file_url' => :'String',
46
+ :'paragraph_path' => :'String',
47
+ :'comment_to_insert' => :'DocxComment'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'InputFileBytes')
60
+ self.input_file_bytes = attributes[:'InputFileBytes']
61
+ end
62
+
63
+ if attributes.has_key?(:'InputFileUrl')
64
+ self.input_file_url = attributes[:'InputFileUrl']
65
+ end
66
+
67
+ if attributes.has_key?(:'ParagraphPath')
68
+ self.paragraph_path = attributes[:'ParagraphPath']
69
+ end
70
+
71
+ if attributes.has_key?(:'CommentToInsert')
72
+ self.comment_to_insert = attributes[:'CommentToInsert']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ 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}=)?$/)
82
+ 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}=)?$/.")
83
+ end
84
+
85
+ return invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ 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}=)?$/)
92
+ return true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] input_file_bytes Value to be assigned
97
+ def input_file_bytes=(input_file_bytes)
98
+
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
+ 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}=)?$/."
101
+ end
102
+
103
+ @input_file_bytes = input_file_bytes
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
+ input_file_bytes == o.input_file_bytes &&
112
+ input_file_url == o.input_file_url &&
113
+ paragraph_path == o.paragraph_path &&
114
+ comment_to_insert == o.comment_to_insert
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [input_file_bytes, input_file_url, paragraph_path, comment_to_insert].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end