Class: AllscriptsApi::Documents::DocumentSender
- Inherits:
-
Object
- Object
- AllscriptsApi::Documents::DocumentSender
- Defined in:
- lib/allscripts_api/documents/document_sender.rb
Overview
Wraps AllscriptsApi::Documents::Document.build_xml and AllscriptsApi::Documents::DocumentMethods#save_document_image to handle the 2 step document image saving process The DocumentSender is set up to send the document as one big chunk
Instance Method Summary collapse
-
#initialize(client, document, file_name, params) ⇒ AllscriptsApi::Documents::DocumentSender
constructor
rubocop:disable LineLength The new method sets up eerything needed to run #send_document.
-
#send_document ⇒ Hash, MagicError
Sends the document in 2 steps, first the doc itself, then a confirmation that it is done and ready to be saved.
Constructor Details
#initialize(client, document, file_name, params) ⇒ AllscriptsApi::Documents::DocumentSender
rubocop:disable LineLength The new method sets up eerything needed to run #send_document
rubocop:enable LineLength
36 37 38 39 40 41 42 43 |
# File 'lib/allscripts_api/documents/document_sender.rb', line 36 def initialize(client, document, file_name, params) @params = params @patient_id = @params[:patient_id] raise MissingRequiredParamsError, "patient_id required" unless @patient_id @client = client @document = Base64.encode64(document) @file_name = file_name end |
Instance Method Details
#send_document ⇒ Hash, MagicError
Sends the document in 2 steps, first the doc itself, then a confirmation that it is done and ready to be saved.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/allscripts_api/documents/document_sender.rb', line 48 def send_document @params[:b_done_upload] = "false" first_step_xml = Documents::Document.build_xml(@file_name, "i", @params) results = @client.save_document_image(@patient_id, first_step_xml, @document) @params[:b_done_upload] = "true" @params[:document_var] = results[0]["documentVar"] second_step_xml = Documents::Document.build_xml(@file_name, "i", @params) @client.save_document_image(@patient_id, second_step_xml, @document) end |