Sha256: 1abb3e80e25a5b2f186f26d1939a6523f88fdf081de4cdf6a3ffe1b528987cbf

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require 'active_support/time'
require 'allscripts_unity_client/utilities'
require 'allscripts_unity_client/unity_request'
require 'allscripts_unity_client/json_unity_request'
require 'allscripts_unity_client/unity_response'
require 'allscripts_unity_client/json_unity_response'
require 'allscripts_unity_client/client'
require 'allscripts_unity_client/client_driver'
require 'allscripts_unity_client/client_options'
require 'allscripts_unity_client/json_client_driver'

# A library for consuming Allscripts Unity web services.
module AllscriptsUnityClient

  # Any error returned from Unity is thrown as this error type
  # with the error message.
  class APIError < RuntimeError
  end

  # Raised whenever the security token could not be retrieved Unity.
  class GetSecurityTokenError < RuntimeError
  end

  # Create an instance of the Unity client.
  #
  # options:: See ClientOptions.
  #
  # Returns an instance of Client.
  def self.create(options = {})
    options[:mode] ||= :json
    if options[:log] != false # explicitly
      options[:log] = true
    end

    if options[:mode] == :json
      client_driver = JSONClientDriver.new(options)
    else
      raise ArgumentError, ':mode must be :json' unless options[:mode] == :json
    end

    Client.new(client_driver)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
allscripts_unity_client-4.0.1 lib/allscripts_unity_client.rb
allscripts_unity_client-4.0.0 lib/allscripts_unity_client.rb
allscripts_unity_client-3.4.1 lib/allscripts_unity_client.rb
allscripts_unity_client-3.4.0 lib/allscripts_unity_client.rb