class Akamai::Command

Public Instance Methods

purge(*urls) click to toggle source
# File lib/akamairb/command.rb, line 12
def purge(*urls)
  client = Akamai::Connection.new(config)
  client.purge_and_progress(*urls, &printter) 
  puts
end
show(id) click to toggle source
# File lib/akamairb/command.rb, line 20
def show(id)
  client = Akamai::Connection.new(config)
  client.progress_until_done("/ccu/v2/purges/#{id}", &printter)
  puts
end

Private Instance Methods

config() click to toggle source
# File lib/akamairb/command.rb, line 28
def config
  begin
    config_path = "#{Dir.home}/.akamai.yml"
    config_file = open(config_path)
    config = YAML.load(config_file)
  rescue
    config = nil
  end

  unless config
    say "Configuration is empty. Please check your '~/.akamai.yml'", :red
    exit -1
  end

  config
end
printter() click to toggle source
# File lib/akamairb/command.rb, line 45
def printter
  Proc.new do |response|
    if options[:debug]
      puts
      pp response
    else
      print "         \r#{response["purgeId"]} => #{response["purgeStatus"]}"
    end
  end
end