def get_medication_by_trans_id(userid, patientid, transaction_id)
      magic_parameters = {
        action: 'GetMedicationByTransID',
        userid: userid,
        patientid: patientid,
        parameter1: transaction_id
      }
      result = magic(magic_parameters)

      if transaction_id == 0 || transaction_id == '0'
        # When transaction_id is 0 all medications should be
        # returned and the result should always be an array.
        if !result.is_a?(Array) && !result.empty?
          result = [ result ]
        elsif result.empty?
          result = []
        end
      end

      result
    end
def get_medication_by_trans_id(userid, patientid, transaction_id)
      magic_parameters = {
        action: 'GetMedicationByTransID',
        userid: userid,
        patientid: patientid,
        parameter1: transaction_id
      }
      result = magic(magic_parameters)

      if transaction_id == 0 || transaction_id == '0'
        # When transaction_id is 0 all medications should be
        # returned and the result should always be an array.
        if !result.is_a?(Array) && !result.empty?
          result = [ result ]
        elsif result.empty?
          result = []
        end
      end

      result
    end
@param [String] userid the Allscripts EHR username.

 @param [Numeric,String] patient_id the Allscripts internal patient ID.

 @param [Numeric,String] transaction_id the transaction ID of the
   RX in question. M prefix=medication, H prefix=historic
   medication.

 @return [Array] if {transaction_id} is either 0 or "0".

 @return [Hash] if {transaction_id} is not 0 or "0".