Class: Codeforces::Api::ProblemSet

Inherits:
Object
  • Object
show all
Defined in:
lib/codeforces/api/problem_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_client) ⇒ ProblemSet

Returns a new instance of ProblemSet.



7
8
9
# File 'lib/codeforces/api/problem_set.rb', line 7

def initialize(base_client)
  @client = base_client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



31
32
33
# File 'lib/codeforces/api/problem_set.rb', line 31

def method_missing(method, *args, &block)
  client.send method, *args, &block
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/codeforces/api/problem_set.rb', line 5

def client
  @client
end

Instance Method Details

#problem_statistics(options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/codeforces/api/problem_set.rb', line 17

def problem_statistics(options = {})
  options[:query] ||= {}
  options[:query][:tags] = multi_values(options[:query][:tags]) unless options[:query][:tags].nil?
  get("problemset.problems", options).problemStatistics
end

#problems(options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/codeforces/api/problem_set.rb', line 11

def problems(options = {})
  options[:query] ||= {}
  options[:query][:tags] = multi_values(options[:query][:tags]) unless options[:query][:tags].nil?
  get("problemset.problems", options).problems
end

#recent_status(options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/codeforces/api/problem_set.rb', line 23

def recent_status(options = {})
  options[:query] ||= {}
  options[:query].merge! paginate(0)
  get("problemset.recentStatus", options)
end