Sha256: 0f09eaeb449da5d416be46657a7d118833989bbfe924940d278647ae3a3e9ff3

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 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

  # Raised when user attempts to make unauthenticated calls.
  class UnauthenticatedError < StandardError; end

  # Create an instance of the Unity client.
  #
  # options:: See ClientOptions.
  #
  # Returns an instance of Client.
  def self.create(options = {})
    options[:mode] ||= :json
    options[:raw_dates] ||= false
    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

7 entries across 7 versions & 1 rubygems

Version Path
allscripts_unity_client-5.1.4 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.4.pre.2 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.4.pre.1 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.3 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.2 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.1 lib/allscripts_unity_client.rb
allscripts_unity_client-5.1.0 lib/allscripts_unity_client.rb