Sha256: 59ba15054cbce34a10ca025e532cee64bc73be2c242634cd0774e4236859e592

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'allscripts_unity_client/utilities'
require 'allscripts_unity_client/timezone'
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/soap_client_driver'
require 'allscripts_unity_client/json_client_driver'

module AllscriptsUnityClient
  class APIError < RuntimeError
  end

  def self.create(options = {})
    options[:mode] ||= :soap
    options[:log] = true unless options[:log] === false
    raise_if_options_invalid options

    if options[:mode] == :json
      client_driver = JSONClientDriver.new(options)
    else
      client_driver = SOAPClientDriver.new(options)
    end

    client = Client.new(client_driver)
    client
  end

  private

  def self.raise_if_options_invalid(options)
    raise ArgumentError, ':mode must be :json or :soap' unless [:json, :soap].include?(options[:mode])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
allscripts_unity_client-2.0.5 lib/allscripts_unity_client.rb
allscripts_unity_client-2.0.4 lib/allscripts_unity_client.rb
allscripts_unity_client-2.0.3 lib/allscripts_unity_client.rb
allscripts_unity_client-2.0.2 lib/allscripts_unity_client.rb
allscripts_unity_client-2.0.1 lib/allscripts_unity_client.rb
allscripts_unity_client-2.0.0 lib/allscripts_unity_client.rb