Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.
/ ChgkRating Public archive

Opinionated Ruby client for the competitive What? Where? When? rating WebAPI

License

Notifications You must be signed in to change notification settings

bodrovis/ChgkRating

Repository files navigation

ChgkRating

Gem Version CI Test Coverage

This gem is in passive maintenance mode. I won't release any new features or introduce any complex enhancements as ChgkRating v1 is deprecated. Please use rating-chgk-v2 gem which works with the new version of the API.

Ruby interface for the rating.chgk.info WebAPI. This is not just a wrapper, but rather a quite complex opinionated client that allows to easily work with various API resources.

Competitive CHGK (aka "What? Where? When?") is a popular intellectual game where teams of up to six people are trying to find an answers to various questions.

The main documentation can be found at the official website.

Документация на русском языке также доступна на официальном сайте.

Documentation can also be found on RubyDoc.

Installation and Requirements

This gem works only with Ruby 2.4+ and I have no plans of making it compatible with older versions. Apart from that, it has no special requirements.

Install it by running:

$ gem install chgk_rating

A Very Quick Example

# Instantiate the client:
client = ChgkRating.client

# Get all players:
client.players 

# Get a specific team:
team = client.team 1 

# Get information about the team at a given tournament:
team.at_tournament 1000 

# Get results for the given team as the tournament:
team.at_tournament(1000).results

# The same data can be fetched with: 
client.team_results_at_tournament 1000, team

# Or you can even grab the tournament and pass it later:
tournament = client.tournament 1000

team.at_tournament(tournament).results
# OR
client.team_results_at_tournament tournament, team

Testing

Tests run against mock responses so you don't need to perform any special setup. Simply pull the code and run:

$ bundle install
$ rspec . 

License

This plugin is licensed under the MIT License.

Copyright (c) Ilya Krukowski