Sha256: 8c00088c393178cdd0769ac4b4b0dce88122242381972303e37b133c4e8dcba2

Contents?: true

Size: 721 Bytes

Versions: 3

Compression:

Stored size: 721 Bytes

Contents

module CodewarsApi
  class AttemptSolution
    include Common

    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)
      request_options = RequestHelper.add_body_options(request_options, options)

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
codewars_api-0.4.2 lib/codewars_api/attempt_solution.rb
codewars_api-0.4.1 lib/codewars_api/attempt_solution.rb
codewars_api-0.4.0 lib/codewars_api/attempt_solution.rb