lib/akamai_ccu/cli.rb in akamai_ccu-1.4.1 vs lib/akamai_ccu/cli.rb in akamai_ccu-1.5.0

- old
+ new

@@ -24,20 +24,15 @@ 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, Client, @logger) + @wrapper_klass.setup(@secret_klass.by_file(@secret), Client, @logger) wrapper = @wrapper_klass.new(endpoint: endpoint, headers: Array(@headers)) @logger.info wrapper.call(@objects).to_s end - private def secret - return @secret_klass.by_txt(@secret) if File.extname(@secret) == ".txt" - @secret_klass.by_edgerc(@secret) - end - private def endpoint @endpoint_klass.new(network, action, mode) end private def mode @@ -52,16 +47,12 @@ data.map(&:to_i).reject(&:zero?) end private def parser OptionParser.new do |opts| - opts.banner = %Q{Usage: ccu_#{@action} --edgerc=./.edgerc --production --cp="12345, 98765"} + opts.banner = %Q{Usage: ccu_#{@action} --secret=~/.edgerc --production --cp="12345, 98765"} - opts.on("-eEDGERC", "--edgerc=EDGERC", "Load secret by .edgerc file") do |secret| - @secret = File.expand_path(secret) - end - - opts.on("-tTXT", "--txt=TXT", "Load secret by TXT file") do |secret| + opts.on("-sSECRET", "--secret=SECRET", "Load secret data by file") do |secret| @secret = File.expand_path(secret) end opts.on("-cCP", "--cp=CP", "Specify contents by provider (CP) codes") do |objects| @objects = objects.split(",").map(&:strip).map(&:to_i)