Class: CodewarsApi::TrainNextKata
- Inherits:
-
Object
- Object
- CodewarsApi::TrainNextKata
- Includes:
- Common
- Defined in:
- lib/codewars_api/train_next_kata.rb
Instance Method Summary collapse
- #author ⇒ Object
- #average_completion ⇒ Object
- #code ⇒ Object
- #code_setup ⇒ Object
- #description ⇒ Object
- #href ⇒ Object
-
#initialize(options) ⇒ TrainNextKata
constructor
A new instance of TrainNextKata.
- #name ⇒ Object
- #project_id ⇒ Object
- #rank ⇒ Object
- #slug ⇒ Object
- #solution_id ⇒ Object
- #tags ⇒ Object
- #tests_setup ⇒ Object
Methods included from Common
Constructor Details
#initialize(options) ⇒ TrainNextKata
Returns a new instance of TrainNextKata.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/codewars_api/train_next_kata.rb', line 5 def initialize() api_key = .delete!(:api_key) language = .delete!(:language) = {} = RequestHelper.add_api_key(, api_key) = RequestHelper.(, ) @response = RequestHelper.post( "#{CodewarsApi::API_URL}/code-challenges/#{language}/train", ) ResponseChecker.check_errors(@response) end |
Instance Method Details
#author ⇒ Object
36 37 38 |
# File 'lib/codewars_api/train_next_kata.rb', line 36 def @response.to_h['author'] end |
#average_completion ⇒ Object
44 45 46 |
# File 'lib/codewars_api/train_next_kata.rb', line 44 def average_completion @response.to_h['averageCompletion'] end |
#code ⇒ Object
68 69 70 |
# File 'lib/codewars_api/train_next_kata.rb', line 68 def code @response.to_h['session'].andand['code'] end |
#code_setup ⇒ Object
60 61 62 |
# File 'lib/codewars_api/train_next_kata.rb', line 60 def code_setup @response.to_h['session'].andand['setup'] end |
#description ⇒ Object
32 33 34 |
# File 'lib/codewars_api/train_next_kata.rb', line 32 def description @response.to_h['description'] end |
#href ⇒ Object
28 29 30 |
# File 'lib/codewars_api/train_next_kata.rb', line 28 def href @response.to_h['href'] end |
#name ⇒ Object
20 21 22 |
# File 'lib/codewars_api/train_next_kata.rb', line 20 def name @response.to_h['name'] end |
#project_id ⇒ Object
52 53 54 |
# File 'lib/codewars_api/train_next_kata.rb', line 52 def project_id @response.to_h['session'].andand['projectId'] end |
#rank ⇒ Object
40 41 42 |
# File 'lib/codewars_api/train_next_kata.rb', line 40 def rank @response.to_h['rank'] end |
#slug ⇒ Object
24 25 26 |
# File 'lib/codewars_api/train_next_kata.rb', line 24 def slug @response.to_h['slug'] end |
#solution_id ⇒ Object
56 57 58 |
# File 'lib/codewars_api/train_next_kata.rb', line 56 def solution_id @response.to_h['session'].andand['solutionId'] end |
#tags ⇒ Object
48 49 50 |
# File 'lib/codewars_api/train_next_kata.rb', line 48 def @response.to_h['tags'] end |
#tests_setup ⇒ Object
64 65 66 |
# File 'lib/codewars_api/train_next_kata.rb', line 64 def tests_setup @response.to_h['session'].andand['exampleFixture'] end |