Sha256: 5476aab5fb28b793cdf28a7068067f618e919043e1050ec62d420a0f761f5565
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
module AllscriptsUnityClient class ClientOptions attr_accessor :proxy, :logger attr_reader :base_unity_url, :username, :password, :appname, :timezone def initialize(options = {}) @base_unity_url = options[:base_unity_url] ? options[:base_unity_url].gsub(/\/$/, '') : nil @username = options[:username] @password = options[:password] @appname = options[:appname] @proxy = options[:proxy] self.timezone = options[:timezone] @logger = options[:logger] validate_options end def validate_options(options = {}) base_unity_url = options.has_key?(:base_unity_url) ? options[:base_unity_url] : @base_unity_url username = options.has_key?(:username) ? options[:username] : @username password = options.has_key?(:password) ? options[:password] : @password appname = options.has_key?(:appname) ? options[:appname] : @appname raise ArgumentError, 'base_unity_url can not be nil' if base_unity_url.nil? raise ArgumentError, 'username can not be nil' if username.nil? raise ArgumentError, 'password can not be nil' if password.nil? raise ArgumentError, 'appname can not be nil' if appname.nil? end def base_unity_url=(base_unity_url) validate_options(base_unity_url: base_unity_url) @base_unity_url = base_unity_url.gsub /\/$/, '' end def username=(username) validate_options(username: username) @username = username end def password=(password) validate_options(password: password) @password = password end def appname=(appname) validate_options(appname: appname) @appname = appname end def timezone=(timezone) if !timezone.nil? @timezone = Timezone.new(timezone) else @timezone = Timezone.new('UTC') end end def proxy? return false if @proxy.nil? return false if @proxy.empty? true end def logger? !@logger.nil? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
allscripts_unity_client-2.0.0 | lib/allscripts_unity_client/client_options.rb |