Hi there. Today, I wrote codeforces API client library in Ruby. Check it out ;-)
https://github.com/sh19910711/codeforces-api-client
0. Installation
We can install it by typing:
$ gem install codeforces
1. Usage
Example Code
Here is an example code for getting a user's information:
# first, load client library
require "codeforces"
# and then call web api you need
tourist = Codeforces.user("tourist")
puts tourist.rating # -> 3254
puts tourist.rank # -> international grandmaster
API Compatibility
The library has interface compatible with Codeforces API:
# get contest list
Codeforces.api.contest.list.each do |contest|
puts contest.name
end
# same as below:
Codeforces.each_contest {|contest| puts contest.name }
2. Contributing
We can:
- Fork it ( https://github.com/sh19910711/codeforces-api-client/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
The library's API reference is here. See also here
Thank you,
Here is a gif:
v0.0.7: The
contests#grep()
function is supported now . It allows that we can find contests by using regexp or string:Here is a GIF:
New version of codeforces ruby gem is out :-)
Changelog:
v0.0.9
Examples of New Features