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 |
# 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", ) end |
Instance Method Details
#author ⇒ Object
35 36 37 |
# File 'lib/codewars_api/train_next_kata.rb', line 35 def @response.to_h['author'] end |
#average_completion ⇒ Object
43 44 45 |
# File 'lib/codewars_api/train_next_kata.rb', line 43 def average_completion @response.to_h['averageCompletion'] end |
#code ⇒ Object
67 68 69 |
# File 'lib/codewars_api/train_next_kata.rb', line 67 def code @response.to_h['session'].andand['code'] end |
#code_setup ⇒ Object
59 60 61 |
# File 'lib/codewars_api/train_next_kata.rb', line 59 def code_setup @response.to_h['session'].andand['setup'] end |
#description ⇒ Object
31 32 33 |
# File 'lib/codewars_api/train_next_kata.rb', line 31 def description @response.to_h['description'] end |
#href ⇒ Object
27 28 29 |
# File 'lib/codewars_api/train_next_kata.rb', line 27 def href @response.to_h['href'] end |
#name ⇒ Object
19 20 21 |
# File 'lib/codewars_api/train_next_kata.rb', line 19 def name @response.to_h['name'] end |
#project_id ⇒ Object
51 52 53 |
# File 'lib/codewars_api/train_next_kata.rb', line 51 def project_id @response.to_h['session'].andand['projectId'] end |
#rank ⇒ Object
39 40 41 |
# File 'lib/codewars_api/train_next_kata.rb', line 39 def rank @response.to_h['rank'] end |
#slug ⇒ Object
23 24 25 |
# File 'lib/codewars_api/train_next_kata.rb', line 23 def slug @response.to_h['slug'] end |
#solution_id ⇒ Object
55 56 57 |
# File 'lib/codewars_api/train_next_kata.rb', line 55 def solution_id @response.to_h['session'].andand['solutionId'] end |
#tags ⇒ Object
47 48 49 |
# File 'lib/codewars_api/train_next_kata.rb', line 47 def @response.to_h['tags'] end |
#tests_setup ⇒ Object
63 64 65 |
# File 'lib/codewars_api/train_next_kata.rb', line 63 def tests_setup @response.to_h['session'].andand['exampleFixture'] end |