Class: CodewarsApi::TrainSpecificKata
- Inherits:
-
Object
- Object
- CodewarsApi::TrainSpecificKata
- Includes:
- Common
- Defined in:
- lib/codewars_api/train_specific_kata.rb
Instance Method Summary collapse
- #author ⇒ Object
- #average_completion ⇒ Object
- #code ⇒ Object
- #code_setup ⇒ Object
- #description ⇒ Object
-
#initialize(options) ⇒ TrainSpecificKata
constructor
A new instance of TrainSpecificKata.
- #name ⇒ Object
- #project_id ⇒ Object
- #rank ⇒ Object
- #recently_attempted ⇒ Object
- #slug ⇒ Object
- #solution_id ⇒ Object
- #tags ⇒ Object
- #tests_setup ⇒ Object
Methods included from Common
Constructor Details
#initialize(options) ⇒ TrainSpecificKata
Returns a new instance of TrainSpecificKata.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/codewars_api/train_specific_kata.rb', line 5 def initialize() api_key = .delete!(:api_key) language = .delete!(:language) id_or_slug = .delete!(:id_or_slug) = {} = RequestHelper.add_api_key(, api_key) @response = RequestHelper.post( "#{CodewarsApi::API_URL}/code-challenges/#{id_or_slug}/#{language}/train", ) end |
Instance Method Details
#author ⇒ Object
31 32 33 |
# File 'lib/codewars_api/train_specific_kata.rb', line 31 def @response.to_h['author'] end |
#average_completion ⇒ Object
39 40 41 |
# File 'lib/codewars_api/train_specific_kata.rb', line 39 def average_completion @response.to_h['averageCompletion'] end |
#code ⇒ Object
63 64 65 |
# File 'lib/codewars_api/train_specific_kata.rb', line 63 def code @response.to_h['session'].andand['code'] end |
#code_setup ⇒ Object
55 56 57 |
# File 'lib/codewars_api/train_specific_kata.rb', line 55 def code_setup @response.to_h['session'].andand['setup'] end |
#description ⇒ Object
27 28 29 |
# File 'lib/codewars_api/train_specific_kata.rb', line 27 def description @response.to_h['description'] end |
#name ⇒ Object
19 20 21 |
# File 'lib/codewars_api/train_specific_kata.rb', line 19 def name @response.to_h['name'] end |
#project_id ⇒ Object
47 48 49 |
# File 'lib/codewars_api/train_specific_kata.rb', line 47 def project_id @response.to_h['session'].andand['projectId'] end |
#rank ⇒ Object
35 36 37 |
# File 'lib/codewars_api/train_specific_kata.rb', line 35 def rank @response.to_h['rank'] end |
#recently_attempted ⇒ Object
67 68 69 |
# File 'lib/codewars_api/train_specific_kata.rb', line 67 def recently_attempted @response.to_h['session'].andand['recentlyAttempted'] end |
#slug ⇒ Object
23 24 25 |
# File 'lib/codewars_api/train_specific_kata.rb', line 23 def slug @response.to_h['slug'] end |
#solution_id ⇒ Object
51 52 53 |
# File 'lib/codewars_api/train_specific_kata.rb', line 51 def solution_id @response.to_h['session'].andand['solutionId'] end |
#tags ⇒ Object
43 44 45 |
# File 'lib/codewars_api/train_specific_kata.rb', line 43 def @response.to_h['tags'] end |
#tests_setup ⇒ Object
59 60 61 |
# File 'lib/codewars_api/train_specific_kata.rb', line 59 def tests_setup @response.to_h['session'].andand['exampleFixture'] end |