lib/servicenow.rb in servicenow-0.0.3 vs lib/servicenow.rb in servicenow-1.0.0

- old
+ new

@@ -1,5 +1,57 @@ require 'servicenow/version' require 'servicenow/client' require 'servicenow/change' -module Servicenow; end +module Servicenow + + @logger = nil + @configuration = nil + + class BaseError < StandardError; end + class MissingParameterError < BaseError; end + + + # Set up Servicenow config + # + # @example Set up with username. Password and URL would come from environemnt + # Servicenow.configure do |config| + # config.username = 'foo' + # end + # + # @yieldparam config [Servicenow::Configuration] + def self.configure(&block) + if @configuration.nil? + @configuration = OpenStruct.new({}) + end + yield @configuration + end + + + # @return [Servicenow::Configuration] + def self.configuration + if @configuration.nil? + @configuration = OpenStruct.new({}) + end + @configuration + end + + + # @param [Logger] new_logger new logger for module + # + # @return [Logger] + def self.logger=(new_logger) + @logger = new_logger + end + + + # @todo filter password + # + # @return [Logger] the module logger + def self.logger + if @logger.nil? + @logger = Logger.new(STDOUT) + end + @logger + end + +end