class Codewars::Finalize
Public Class Methods
new(client)
click to toggle source
# File lib/codewars/finalize.rb, line 3 def initialize(client) desc = Description.new slug = desc.take_value_from_file(/Slug: (.+)/, 'Slug') project_id = desc.take_value_from_file(/Project ID: (.+)/, 'Project ID') solution_id = desc.take_value_from_file(/Solution ID: (.+)/, 'Solution ID') result = client.finalize_solution( project_id: project_id, solution_id: solution_id ) handle_result(result, slug) end
Private Instance Methods
handle_result(result, slug)
click to toggle source
# File lib/codewars/finalize.rb, line 18 def handle_result(result, slug) if result.success say 'Your solution has been finalized.' say "Other solutions can be found here: #{CODEWARS_URL}/kata/#{slug}/solutions/" else raise Thor::Error, 'Something went wrong. Try to sumbit the solution again.' end end