Class: Pdf4me::ConvertFileToPdf

Inherits:
WrapperAction show all
Defined in:
lib/pdf4me/actions/convert_file_to_pdf.rb

Instance Attribute Summary collapse

Attributes inherited from WrapperAction

#client

Instance Method Summary collapse

Methods inherited from WrapperAction

#assign_attributes, #defaults, #initialize, #run, #run!

Constructor Details

This class inherits a constructor from Pdf4me::WrapperAction

Instance Attribute Details

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/pdf4me/actions/convert_file_to_pdf.rb', line 3

def file
  @file
end

#save_pathObject

Returns the value of attribute save_path.



3
4
5
# File 'lib/pdf4me/actions/convert_file_to_pdf.rb', line 3

def save_path
  @save_path
end

Instance Method Details

#call_apiObject



22
23
24
25
26
27
28
29
30
# File 'lib/pdf4me/actions/convert_file_to_pdf.rb', line 22

def call_api
  client.multipart_post(
    path,
    file_name: File.basename(file),
    file: File.open(file, 'rb'),
  ) do |request|
    download(request, save_path)
  end
end

#pathObject



12
13
14
# File 'lib/pdf4me/actions/convert_file_to_pdf.rb', line 12

def path
  '/Convert/ConvertFileToPdf'
end