lib/akamai_ccu/cli.rb in akamai_ccu-1.3.9 vs lib/akamai_ccu/cli.rb in akamai_ccu-1.4.0

- old
+ new

@@ -3,18 +3,20 @@ require "akamai_ccu/wrapper" module AkamaiCCU class CLI SCHEME = "http" + LOG_LEVEL = Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")) attr_reader :network, :action def initialize(args:, action:, io: STDOUT, wrapper_klass: Wrapper, secret_klass: Secret, endpoint_klass: Endpoint) @args = args @action = action @io = io @logger = Logger.new(io) + @logger.level = LOG_LEVEL @wrapper_klass = wrapper_klass @secret_klass = secret_klass @endpoint_klass = endpoint_klass @network = Endpoint::Network::STAGING end @@ -22,10 +24,10 @@ def call parser.parse!(@args) return @logger.warn("specify contents to purge by bulk, CP codes or urls") if Array(@objects).empty? return @logger.warn("specify path to the secret file either by edgerc or by txt") unless @secret return @logger.warn("specified secret file does not exist") unless File.exist?(@secret) - @wrapper_klass.setup(secret) + @wrapper_klass.setup(secret, Client, @logger) wrapper = @wrapper_klass.new(endpoint: endpoint, headers: Array(@headers)) @logger.info wrapper.call(@objects).to_s end private def secret