class Codewars::CLI

Public Instance Methods

attempt() click to toggle source
# File lib/codewars/cli.rb, line 16
def attempt
  Attempt.new(client)
end
finalize() click to toggle source
# File lib/codewars/cli.rb, line 21
def finalize
  Finalize.new(client)
end
train(id_or_slug = nil) click to toggle source
# File lib/codewars/cli.rb, line 7
def train(id_or_slug = nil)
  if id_or_slug
    TrainSpecific.new(client, id_or_slug)
  else
    TrainNext.new(client)
  end
end

Private Instance Methods

client() click to toggle source
# File lib/codewars/cli.rb, line 27
def client
  api_key = read_api_key
  CodewarsApi::Client.new(api_key: api_key)
end
read_api_key() click to toggle source
# File lib/codewars/cli.rb, line 32
def read_api_key
  api_key = Configuration.option('api_key')
  api_key || raise(Thor::Error, 'You should set an api-key to use this command')
end