class DocRaptor::DocApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/docraptor/api/doc_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_async_doc(doc, opts = {}) click to toggle source

Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. @param doc The document to be created. @param [Hash] opts the optional parameters @return [AsyncDoc]

# File lib/docraptor/api/doc_api.rb, line 26
def create_async_doc(doc, opts = {})
  data, _status_code, _headers = create_async_doc_with_http_info(doc, opts)
  data
end
create_async_doc_with_http_info(doc, opts = {}) click to toggle source

Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. @param doc The document to be created. @param [Hash] opts the optional parameters @return [Array<(AsyncDoc, Fixnum, Hash)>] AsyncDoc data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 35
def create_async_doc_with_http_info(doc, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.create_async_doc ...'
  end
  # verify the required parameter 'doc' is set
  if @api_client.config.client_side_validation && doc.nil?
    fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_async_doc"
  end
  # resource path
  local_var_path = '/async_docs'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(doc)
  auth_names = ['basicAuth']
  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 => 'AsyncDoc')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocApi#create_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_doc(doc, opts = {}) click to toggle source

Creates a document synchronously. @param doc The document to be created. @param [Hash] opts the optional parameters @return [String]

# File lib/docraptor/api/doc_api.rb, line 76
def create_doc(doc, opts = {})
  data, _status_code, _headers = create_doc_with_http_info(doc, opts)
  data
end
create_doc_with_http_info(doc, opts = {}) click to toggle source

Creates a document synchronously. @param doc The document to be created. @param [Hash] opts the optional parameters @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 85
def create_doc_with_http_info(doc, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.create_doc ...'
  end
  # verify the required parameter 'doc' is set
  if @api_client.config.client_side_validation && doc.nil?
    fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_doc"
  end
  # resource path
  local_var_path = '/docs'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(doc)
  auth_names = ['basicAuth']
  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: DocApi#create_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_hosted_async_doc(doc, opts = {}) click to toggle source

Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. @param doc The document to be created. @param [Hash] opts the optional parameters @return [AsyncDoc]

# File lib/docraptor/api/doc_api.rb, line 126
def create_hosted_async_doc(doc, opts = {})
  data, _status_code, _headers = create_hosted_async_doc_with_http_info(doc, opts)
  data
end
create_hosted_async_doc_with_http_info(doc, opts = {}) click to toggle source

Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document. @param doc The document to be created. @param [Hash] opts the optional parameters @return [Array<(AsyncDoc, Fixnum, Hash)>] AsyncDoc data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 135
def create_hosted_async_doc_with_http_info(doc, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.create_hosted_async_doc ...'
  end
  # verify the required parameter 'doc' is set
  if @api_client.config.client_side_validation && doc.nil?
    fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_hosted_async_doc"
  end
  # resource path
  local_var_path = '/hosted_async_docs'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(doc)
  auth_names = ['basicAuth']
  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 => 'AsyncDoc')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocApi#create_hosted_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_hosted_doc(doc, opts = {}) click to toggle source

Creates a hosted document synchronously. @param doc The document to be created. @param [Hash] opts the optional parameters @return [DocStatus]

# File lib/docraptor/api/doc_api.rb, line 176
def create_hosted_doc(doc, opts = {})
  data, _status_code, _headers = create_hosted_doc_with_http_info(doc, opts)
  data
end
create_hosted_doc_with_http_info(doc, opts = {}) click to toggle source

Creates a hosted document synchronously. @param doc The document to be created. @param [Hash] opts the optional parameters @return [Array<(DocStatus, Fixnum, Hash)>] DocStatus data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 185
def create_hosted_doc_with_http_info(doc, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.create_hosted_doc ...'
  end
  # verify the required parameter 'doc' is set
  if @api_client.config.client_side_validation && doc.nil?
    fail ArgumentError, "Missing the required parameter 'doc' when calling DocApi.create_hosted_doc"
  end
  # resource path
  local_var_path = '/hosted_docs'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(doc)
  auth_names = ['basicAuth']
  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 => 'DocStatus')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocApi#create_hosted_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
expire(id, opts = {}) click to toggle source

Expires a previously created hosted doc. @param id The download_id returned from status request or hosted document response. @param [Hash] opts the optional parameters @return [nil]

# File lib/docraptor/api/doc_api.rb, line 226
def expire(id, opts = {})
  expire_with_http_info(id, opts)
  nil
end
expire_with_http_info(id, opts = {}) click to toggle source

Expires a previously created hosted doc. @param id The download_id returned from status request or hosted document response. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 235
def expire_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.expire ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.expire"
  end
  # resource path
  local_var_path = '/expire/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocApi#expire\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_async_doc(id, opts = {}) click to toggle source

Downloads a finished document. @param id The download_id returned from an async status request or callback. @param [Hash] opts the optional parameters @return [String]

# File lib/docraptor/api/doc_api.rb, line 275
def get_async_doc(id, opts = {})
  data, _status_code, _headers = get_async_doc_with_http_info(id, opts)
  data
end
get_async_doc_status(id, opts = {}) click to toggle source

Check on the status of an asynchronously created document. @param id The status_id returned when creating an asynchronous document. @param [Hash] opts the optional parameters @return [DocStatus]

# File lib/docraptor/api/doc_api.rb, line 325
def get_async_doc_status(id, opts = {})
  data, _status_code, _headers = get_async_doc_status_with_http_info(id, opts)
  data
end
get_async_doc_status_with_http_info(id, opts = {}) click to toggle source

Check on the status of an asynchronously created document. @param id The status_id returned when creating an asynchronous document. @param [Hash] opts the optional parameters @return [Array<(DocStatus, Fixnum, Hash)>] DocStatus data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 334
def get_async_doc_status_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.get_async_doc_status ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.get_async_doc_status"
  end
  # resource path
  local_var_path = '/status/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DocStatus')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DocApi#get_async_doc_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_async_doc_with_http_info(id, opts = {}) click to toggle source

Downloads a finished document. @param id The download_id returned from an async status request or callback. @param [Hash] opts the optional parameters @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers

# File lib/docraptor/api/doc_api.rb, line 284
def get_async_doc_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DocApi.get_async_doc ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling DocApi.get_async_doc"
  end
  # resource path
  local_var_path = '/download/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  data, status_code, headers = @api_client.call_api(:GET, 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: DocApi#get_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end