Class: Intersail::Rpdf::ZapPdfClient
- Inherits:
-
Object
- Object
- Intersail::Rpdf::ZapPdfClient
- Defined in:
- lib/rpdf/services/zap_pdf_client.rb
Instance Method Summary collapse
- #get_template_tags(templateFile) ⇒ Object
-
#initialize(address) ⇒ ZapPdfClient
constructor
A new instance of ZapPdfClient.
- #make_pdf_with_local_file(templateFile, data, options = {}) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(address) ⇒ ZapPdfClient
Returns a new instance of ZapPdfClient.
7 8 9 10 |
# File 'lib/rpdf/services/zap_pdf_client.rb', line 7 def initialize(address) @url = address @ws = Savon.client(wsdl: "#{address}?wsdl") end |
Instance Method Details
#get_template_tags(templateFile) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rpdf/services/zap_pdf_client.rb', line 28 def (templateFile) templateData = Base64.encode64(File.read(templateFile)) response = @ws.call(:get_template_tags, message: { data: templateData }) return nil unless response = response.body[:get_template_tags_response][:get_template_tags_result] Intersail::Rpdf::Node.new() unless .nil? end |
#make_pdf_with_local_file(templateFile, data, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rpdf/services/zap_pdf_client.rb', line 16 def make_pdf_with_local_file(templateFile, data, = {}) templateData = Base64.encode64(File.read(templateFile)) response = @ws.call(:make_pdf_with_xml, message: { data: templateData, xmlTags: data.to_xml() }) return nil unless response pdfData = response.body[:make_pdf_with_xml_response][:make_pdf_with_xml_result] Base64.decode64(pdfData) end |
#url ⇒ Object
12 13 14 |
# File 'lib/rpdf/services/zap_pdf_client.rb', line 12 def url @url end |