class PDFGeneratorAPI

Public Class Methods

new(headers) click to toggle source
# File lib/pdf_generator_api.rb, line 6
def initialize(headers)
  $headers = headers
  $base_url = "https://us1.pdfgeneratorapi.com/api/v3/"
end

Public Instance Methods

copy(template, name) click to toggle source
# File lib/pdf_generator_api.rb, line 41
def copy(template, name)
  response = HTTParty.post("#{$base_url}templates/#{template}/copy", {headers:  $headers, body: {name: name}})
  response.body
end
create(name) click to toggle source
# File lib/pdf_generator_api.rb, line 18
def  create(name)
  response = HTTParty.post("#{$base_url}templates", {headers:  $headers, body: {name: name}})
  response.body
end
delete(template) click to toggle source
# File lib/pdf_generator_api.rb, line 37
def delete(template)
  response = HTTParty.delete("#{$base_url}templates/#{template}", {headers:  $headers})
  response.body
end
delete_workspace(workspaces) click to toggle source
# File lib/pdf_generator_api.rb, line 45
def delete_workspace(workspaces)
  response = HTTParty.delete("#{$base_url}workspaces/#{workspaces}", {headers:  $headers})
  response.body
end
editor(template, data, params) click to toggle source
# File lib/pdf_generator_api.rb, line 33
def editor(template, data, params)
  response = HTTParty.get("#{$base_url}templates/#{template}/editor" + query_params, {body: data, headers:  $headers})
  response.body
end
get(template) click to toggle source
# File lib/pdf_generator_api.rb, line 14
def get(template)
  response = HTTParty.get("#{$base_url}templates/#{template}", {headers:  $headers})
  response.body
end
getAll(access, tags) click to toggle source
# File lib/pdf_generator_api.rb, line 10
def getAll(access, tags)
    response = HTTParty.get("#{$base_url}templates", {headers:  $headers})
      response.body
end
output(template, data, format, name, params) click to toggle source
# File lib/pdf_generator_api.rb, line 22
def output(template, data, format, name, params)
  config = {
    name: params[:name].nil? ? "sample" : params[:name],
    format: params[:format].nil? ? "pdf" : params[:format],
    output: params[:output].nil? ? "base64" : params[:output]
  }

  query_params = "?name="+ config[:name] + "&&format="+ config[:format] + "&&output=" + config[:output]
  response = HTTParty.post("#{$base_url}templates/#{template}/output" + query_params, {body: data, headers:  $headers})
  response.body
end
sendRequest(method, resource, config) click to toggle source
# File lib/pdf_generator_api.rb, line 49
def sendRequest(method, resource, config)
  # base_url = "#{$base_url}"
  # HTTParty

end