Class: AllscriptsApi::MagicParams

Inherits:
Object
  • Object
show all
Defined in:
lib/allscripts_api/magic_params.rb

Overview

A simple formatter for Magic Action’s numbered perameters

Class Method Summary collapse

Class Method Details

.format(user_id: "", patient_id: "", parameter1: "", parameter2: "", parameter3: "", parameter4: "", parameter5: "", parameter6: "", data: {}) ⇒ Hash

A method for formatting data for the body of Client#magic calls. Magic Actions require all arguments to be present in the HTTP call and in the correct order.

related to the Magic call passed parameters and empty values for unused params

Examples:

formatting params for SearchPatients as seen in NamedMagicMethods#search_patients

MagicParams.format(user_id: "YOUR_APP_USERNAME, parameter1: "Smith")
=> {AppUserID: "YOUR_APP_USERNAME",
  PatientID: "",
  Parameter1: "Smith",
  Parameter2: "",
  Parameter3: "",
  Parameter4: "",
  Parameter5: "",
  Parameter6: "",
  Data: {}}

Parameters:

  • user_id (String) (defaults to: "")

    id or user name of the App/User making the call

  • patient_id (String, Nil) (defaults to: "")

    the optional id of a patient

  • parameter1 (String, Nil) (defaults to: "")

    the optional 1st argument of the Magic call

  • parameter2 (String, Nil) (defaults to: "")

    the optional 2nd argument of the Magic call

  • parameter3 (String, Nil) (defaults to: "")

    the optional 3rd argument of the Magic call

  • parameter4 (String, Nil) (defaults to: "")

    the optional 4th argument of the Magic call

  • parameter5 (String, Nil) (defaults to: "")

    the optional 5th argument of the Magic call

  • parameter6 (String, Nil) (defaults to: "")

    the optional 6th argument of the Magic call

  • data (Hash, Nil) (defaults to: {})

    the optional data argument of the Magic call

Returns:

  • (Hash)

    the method returns a formatted hash containing the



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/allscripts_api/magic_params.rb', line 34

def self.format(user_id: "", patient_id: "", parameter1: "", parameter2: "", parameter3: "", parameter4: "", parameter5: "", parameter6: "", data: {})
  {
    AppUserID: user_id,
    PatientID: patient_id,
    Parameter1: parameter1,
    Parameter2: parameter2,
    Parameter3: parameter3,
    Parameter4: parameter4,
    Parameter5: parameter5,
    Parameter6: parameter6,
    Data: data
  }
end