Class: CodewarsApi::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client


5
6
7
# File 'lib/codewars_api/client.rb', line 5

def initialize(options)
  @api_key = options[:api_key] if options[:api_key]
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key


3
4
5
# File 'lib/codewars_api/client.rb', line 3

def api_key
  @api_key
end

Instance Method Details

#attempt_solution(options) ⇒ Object


27
28
29
30
# File 'lib/codewars_api/client.rb', line 27

def attempt_solution(options)
  add_api_key(options)
  AttemptSolution.new(options)
end

#deferred_response(options) ⇒ Object


37
38
39
40
# File 'lib/codewars_api/client.rb', line 37

def deferred_response(options)
  add_api_key(options)
  DeferredResponse.new(options)
end

#finalize_solution(options) ⇒ Object


32
33
34
35
# File 'lib/codewars_api/client.rb', line 32

def finalize_solution(options)
  add_api_key(options)
  FinalizeSolution.new(options)
end

#kata_info(id_or_slug) ⇒ Object


13
14
15
# File 'lib/codewars_api/client.rb', line 13

def kata_info(id_or_slug)
  KataInfo.new(id_or_slug)
end

#train_next_kata(options) ⇒ Object


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

def train_next_kata(options)
  add_api_key(options)
  TrainNextKata.new(options)
end

#train_specific_kata(options) ⇒ Object


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

def train_specific_kata(options)
  add_api_key(options)
  TrainSpecificKata.new(options)
end

#user(username) ⇒ Object


9
10
11
# File 'lib/codewars_api/client.rb', line 9

def user(username)
  User.new(username)
end