lib/akamai_ccu/cli.rb in akamai_ccu-1.3.7 vs lib/akamai_ccu/cli.rb in akamai_ccu-1.3.8
- old
+ new
@@ -2,10 +2,12 @@
require "optparse"
require "akamai_ccu/wrapper"
module AkamaiCCU
class CLI
+ SCHEME = "http"
+
attr_reader :network, :action
def initialize(args:, action:, io: STDOUT, wrapper_klass: Wrapper, secret_klass: Secret, endpoint_klass: Endpoint)
@args = args
@action = action
@@ -41,13 +43,12 @@
Endpoint::Mode::URL
end
private def bulk_objects(file)
return unless File.exist?(file)
- File.readlines(file).map(&:strip).reject(&:empty?).map do |entry|
- entry = entry.to_i unless entry.start_with?("http")
- entry
- end
+ data = File.readlines(file).map(&:strip).reject(&:empty?)
+ return data if data.all? { |entry| entry.downcase.start_with?(SCHEME) }
+ data.map(&:to_i).reject(&:zero?)
end
private def parser
OptionParser.new do |opts|
opts.banner = %Q{Usage: #{@action} --edgerc=./.edgerc --production --cp="12345, 98765"}