0.0
No commit activity in last 3 years
No release in over 3 years
a ruby wrapper of codeforces api
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.10
~> 10.0
>= 0
 Project Readme

CodeforcesAPI

a ruby wrapper of codeforces api.

Installation

Add this line to your application's Gemfile:

gem 'codeforces_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install codeforces_api

Usage

Configuration

CodeforcesAPI.configure do |config|
  config.key    = YOUR_API_KEY
  config.secret = YOUR_API_SECRET
end

once you setup the api key, all the methods are through authorization. if you have not set up the key info, all the methods are anonymouse.

CodeforcesAPI.reset!

this will clear the api key info.

Methods

let's take me(delta_4d) as an example

me, tourist = CodeforcesAPI.user.info('delta_4d', 'tourist')
puts me.rank      # master
puts tourist.rank # international grandmaster

you can also use the user object

user = CodeforcesAPI.user
first_contest = user.rating('delta_4d')[0]
puts "#{first_contest.contestName} #{first_contest.newRating}"
# Codeforces Beta Round #30 (Codeforces format) 1430

as you can see, the usage are pretty much the same as in the official doc.

Contributing

feel free to file an issue or send a pr.