Class: Codeforces::Api::Contest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_client) ⇒ Contest

Returns a new instance of Contest.



7
8
9
# File 'lib/codeforces/api/contest.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)



37
38
39
# File 'lib/codeforces/api/contest.rb', line 37

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/contest.rb', line 5

def client
  @client
end

Instance Method Details

#hacks(contest_id, options = {}) ⇒ Object



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

def hacks(contest_id, options = {})
  options[:query] ||= {}
  options[:query].merge! :contestId => contest_id
  get("contest.hacks", options)
end

#list(options = {}) ⇒ Object



17
18
19
# File 'lib/codeforces/api/contest.rb', line 17

def list(options = {})
  get("contest.list", options)
end

#standings(contest_id, options = {}) ⇒ Object



21
22
23
24
25
26
# File 'lib/codeforces/api/contest.rb', line 21

def standings(contest_id, options = {})
  options[:query] ||= {}
  options[:query].merge! :contestId => contest_id
  options[:query].merge! paginate(options[:offset])
  get("contest.standings", options).rows
end

#status(contest_id, options = {}) ⇒ Object



28
29
30
31
32
33
# File 'lib/codeforces/api/contest.rb', line 28

def status(contest_id, options = {})
  options[:query] ||= {}
  options[:query].merge! :contestId => contest_id
  options[:query].merge! paginate(options[:offset])
  get("contest.status", options)
end