AllscriptsApi, an Allscripts Unity Client
AllscriptsApi is a simple ruby wrapper around the Allscripts Unity API. This gem specifically focuses on the JSON
functionality of the API and will not support SOAP. Additionally,
allscripts_api focuses on being simple
to use and understand. There are no DSLs, or behind the scenes magic. The code aims to be well documented,
readable, and straightforward to use in your own application. The docs are available here
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install allscripts_api
The client can be used either with ahead of time configuration and instantiated with
AllscriptsApi.connect, or by directly calling
AllscriptsApi::Client.new, and passing your applications credentials.
You may configure the client beforehand with the following config block. If you are using Rails,
this will go in
cofig/initializers. However, the code does not rely on ActiveSupport and can
be configured ahead of time in and Ruby application.
. do |config| config.app_name = 'YOUR_APP_NAME_HERE' config.app_username = 'YOUR_APP_USERNAME_HERE' config.app_password = 'YOUR_APP_PASSWORD_HERE' config.unity_url = 'CHOSEN_UNITY_URL' end
If you have configured you application ahead of time, you can test your set up now.
client = . client.get_token
If this works, the client should set a token, and you should see it printed to the console. If it fails for any reason, it will raise
GetTokenError, and dump the response body of the GetToken call to Unity.
Assuming a successful call to GetToken, next authenticate the test user to that token.
This call will return a
MagicError if it fails.
Directly Building the Client
If you want to use the gem from the console, or without ahead of time configuration, you may do so as follows.
client = ::.(unity_url, app_name, app_username, app_password) client.get_token client.get_user_authentication("jmedici", "password01")
As you can see, after the initial call, usage is the same. That is because
AllscriptsApi.connect returns an instance of
AllscriptsApi::Client. You can find the documentation for
Code of Conduct
Bug reports and pull requests are welcome on GitHub at https://github.com/avhana/allscripts_api.
This gem is provided as is under the MIT license, Copyright (c) 2018 Avhana Health, Inc.