Class: CloudmersiveConvertApiClient::TransformDocumentApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-convert-api-client/api/transform_document_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TransformDocumentApi



19
20
21
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#transform_document_docx_replace(match_string, replace_string, opts = {}) ⇒ String

Replace string in Word DOCX document Replace all instances of a string in an Office Word Document (docx)

Options Hash (opts):

  • :input_file (File)

    Optional: Input file to perform the operation on.

  • :input_file_url (String)

    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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).

  • :match_case (BOOLEAN)

    Optional: True if the case should be matched, false for case insensitive match. Default is false.



31
32
33
34
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 31

def transform_document_docx_replace(match_string, replace_string, opts = {})
  data, _status_code, _headers = transform_document_docx_replace_with_http_info(match_string, replace_string, opts)
  data
end

#transform_document_docx_replace_with_http_info(match_string, replace_string, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Replace string in Word DOCX document Replace all instances of a string in an Office Word Document (docx)

Options Hash (opts):

  • :input_file (File)

    Optional: Input file to perform the operation on.

  • :input_file_url (String)

    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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).

  • :match_case (BOOLEAN)

    Optional: True if the case should be matched, false for case insensitive match. Default is false.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 45

def transform_document_docx_replace_with_http_info(match_string, replace_string, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_replace ...'
  end
  # verify the required parameter 'match_string' is set
  if @api_client.config.client_side_validation && match_string.nil?
    fail ArgumentError, "Missing the required parameter 'match_string' when calling TransformDocumentApi.transform_document_docx_replace"
  end
  # verify the required parameter 'replace_string' is set
  if @api_client.config.client_side_validation && replace_string.nil?
    fail ArgumentError, "Missing the required parameter 'replace_string' when calling TransformDocumentApi.transform_document_docx_replace"
  end
  # resource path
  local_var_path = '/convert/transform/docx/replace-all'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  header_params[:'matchString'] = match_string
  header_params[:'replaceString'] = replace_string
  header_params[:'inputFileUrl'] = opts[:'input_file_url'] if !opts[:'input_file_url'].nil?
  header_params[:'matchCase'] = opts[:'match_case'] if !opts[:'match_case'].nil?

  # form parameters
  form_params = {}
  form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_replace\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#transform_document_pptx_replace(match_string, replace_string, opts = {}) ⇒ String

Replace string in PowerPoint PPTX presentation Replace all instances of a string in an Office PowerPoint Document (pptx)

Options Hash (opts):

  • :input_file (File)

    Optional: Input file to perform the operation on.

  • :input_file_url (String)

    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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).

  • :match_case (BOOLEAN)

    Optional: True if the case should be matched, false for case insensitive match. Default is false.



100
101
102
103
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 100

def transform_document_pptx_replace(match_string, replace_string, opts = {})
  data, _status_code, _headers = transform_document_pptx_replace_with_http_info(match_string, replace_string, opts)
  data
end

#transform_document_pptx_replace_with_http_info(match_string, replace_string, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Replace string in PowerPoint PPTX presentation Replace all instances of a string in an Office PowerPoint Document (pptx)

Options Hash (opts):

  • :input_file (File)

    Optional: Input file to perform the operation on.

  • :input_file_url (String)

    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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).

  • :match_case (BOOLEAN)

    Optional: True if the case should be matched, false for case insensitive match. Default is false.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/cloudmersive-convert-api-client/api/transform_document_api.rb', line 114

def transform_document_pptx_replace_with_http_info(match_string, replace_string, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_pptx_replace ...'
  end
  # verify the required parameter 'match_string' is set
  if @api_client.config.client_side_validation && match_string.nil?
    fail ArgumentError, "Missing the required parameter 'match_string' when calling TransformDocumentApi.transform_document_pptx_replace"
  end
  # verify the required parameter 'replace_string' is set
  if @api_client.config.client_side_validation && replace_string.nil?
    fail ArgumentError, "Missing the required parameter 'replace_string' when calling TransformDocumentApi.transform_document_pptx_replace"
  end
  # resource path
  local_var_path = '/convert/transform/pptx/replace-all'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  header_params[:'matchString'] = match_string
  header_params[:'replaceString'] = replace_string
  header_params[:'inputFileUrl'] = opts[:'input_file_url'] if !opts[:'input_file_url'].nil?
  header_params[:'matchCase'] = opts[:'match_case'] if !opts[:'match_case'].nil?

  # form parameters
  form_params = {}
  form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_pptx_replace\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end