Sha256: 47033dd7daf680a8b2366de269c6196446a18374ac0fae046a19e61ce6ac5353

Contents?: true

Size: 1.34 KB

Versions: 12

Compression:

Stored size: 1.34 KB

Contents

module AllscriptsUnityClient

  # Transform a Unity request into a Hash suitable for sending using Faraday.
  class JSONUnityRequest < UnityRequest

    # Convert the parameters to a Hash for Faraday with all possible dates
    # converted to the Organization's localtime.
    def to_hash
      action = @parameters[:action]
      userid = @parameters[:userid]
      appname = @parameters[:appname] || @appname
      patientid = @parameters[:patientid]
      token = @parameters[:token] || @security_token
      parameter1 = process_date(@parameters[:parameter1]) || ''
      parameter2 = process_date(@parameters[:parameter2]) || ''
      parameter3 = process_date(@parameters[:parameter3]) || ''
      parameter4 = process_date(@parameters[:parameter4]) || ''
      parameter5 = process_date(@parameters[:parameter5]) || ''
      parameter6 = process_date(@parameters[:parameter6]) || ''
      data = Utilities::encode_data(@parameters[:data]) || ''

      {
        'Action' => action,
        'AppUserID' => userid,
        'Appname' => appname,
        'PatientID' => patientid,
        'Token' => token,
        'Parameter1' => parameter1,
        'Parameter2' => parameter2,
        'Parameter3' => parameter3,
        'Parameter4' => parameter4,
        'Parameter5' => parameter5,
        'Parameter6' => parameter6,
        'Data' => data
      }
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
allscripts_unity_client-5.1.4 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.4.pre.2 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.4.pre.1 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.3 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.2 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.1 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.1.0 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.0.0 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.0.0.pre.alpha.1 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-5.0.0.pre.alpha lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-4.0.1 lib/allscripts_unity_client/json_unity_request.rb
allscripts_unity_client-4.0.0 lib/allscripts_unity_client/json_unity_request.rb