Class: CodewarsApi::FinalizeSolution

Inherits:
Object
  • Object
show all
Defined in:
lib/codewars_api/finalize_solution.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ FinalizeSolution


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/codewars_api/finalize_solution.rb', line 3

def initialize(options)
  api_key = options.delete!(:api_key)
  project_id = options.delete!(:project_id)
  solution_id = options.delete!(:solution_id)

  request_options = {}
  request_options = RequestHelper.add_api_key(request_options, api_key)

  @response = RequestHelper.post(
    "#{CodewarsApi::API_URL}"\
    "/code-challenges/projects/#{project_id}/solutions/#{solution_id}/finalize",
    request_options
  )
end

Instance Method Details

#successObject


18
19
20
# File 'lib/codewars_api/finalize_solution.rb', line 18

def success
  @response.to_h['success']
end

#to_hObject


22
23
24
# File 'lib/codewars_api/finalize_solution.rb', line 22

def to_h
  @response.to_h
end