Method: Rightscale::RightSlicehostInterface#init
- Defined in:
- lib/slicehost_base.rb
#init(slicehost_pasword, params = {}) ⇒ Object
Params:
:slicehost_url
:logger
:multi_thread
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/slicehost_base.rb', line 94 def init(slicehost_pasword, params={}) #:nodoc: @params = params @cache = {} @error_handler = nil # deny working without credentials if slicehost_pasword.blank? raise SlicehostError.new("Slicehost password is required to operate on Slicehost API service") end @slicehost_pasword = slicehost_pasword # parse Slicehost URL @params[:slicehost_url] ||= ENV['SLICEHOST_URL'] || DEFAULT_SLICEHOST_URL @params[:server] = URI.parse(@params[:slicehost_url]).host @params[:port] = URI.parse(@params[:slicehost_url]).port @params[:service] = URI.parse(@params[:slicehost_url]).path @params[:protocol] = URI.parse(@params[:slicehost_url]).scheme # other params @params[:multi_thread] ||= defined?(SLICEHOST_DAEMON) @logger = @params[:logger] || (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER) || Logger.new(STDOUT) @logger.info "New #{self.class.name} using #{@params[:multi_thread] ? 'multi' : 'single'}-threaded mode" end |