Method: AsposeWordsCloud::InsertCommentRequest#create_http_request

Defined in:
lib/aspose_words_cloud/models/requests/insert_comment_request.rb

#create_http_request(api_client) ⇒ Object

Raises:

  • (ArgumentError)


158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/aspose_words_cloud/models/requests/insert_comment_request.rb', line 158

def create_http_request(api_client)
  # verify the required parameter 'name' is set
  raise ArgumentError, 'Missing the required parameter name when calling WordsApi.insert_comment' if api_client.config.client_side_validation && self.name.nil?
  # verify the required parameter 'comment' is set
  raise ArgumentError, 'Missing the required parameter comment when calling WordsApi.insert_comment' if api_client.config.client_side_validation && self.comment.nil?
  self.comment.validate
  # resource path
  local_var_path = '/words/{name}/comments'[1..-1]
  local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', self.name.nil? ? '' : self.name.to_s)
  local_var_path = local_var_path.sub('//', '/')

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('Folder')] = self.folder unless self.folder.nil?
  query_params[downcase_first_letter('Storage')] = self.storage unless self.storage.nil?
  query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
  query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
  query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
  query_params[downcase_first_letter('DestFileName')] = self.dest_file_name unless self.dest_file_name.nil?
  query_params[downcase_first_letter('RevisionAuthor')] = self.revision_author unless self.revision_author.nil?
  query_params[downcase_first_letter('RevisionDateTime')] = self.revision_date_time unless self.revision_date_time.nil?

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = api_client.select_header_content_type(['application/xml', 'application/json'])

  # form parameters
  form_params = []
  files_content = []
  if self.comment.nil?
    raise "Parameter Comment is required."
  end
  unless self.comment.nil?
    form_params.push({:'Name' => 'comment', :'Data' => self.comment.to_body.to_json, :'MimeType' =>'application/json'})
  end

  body = api_client.build_request_body(header_params, form_params, files_content)
  {
    'method': :POST,
    'path': local_var_path,
    'header_params': header_params,
    'query_params': query_params,
    'body': body,
    'auth_names': ['JWT']
  }
end