ruby-lol
ruby-lol is a wrapper to the Riot Games API.
Installation
Add this line to your application's Gemfile:
gem 'ruby-lol'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-lol
Usage
[ Outdated, anyone who wants to contribute to this please do it :) ]
require 'lol'
client = Lol::Client.new "my_api_key", region: "euw"
client = Lol::Client.new "my_api_key", region: "euw", redis: "redis://localhost:6379", ttl: 900
client = Lol::Client.new "new_api_key", region: "euw", rate_limit_requests: 1, rate_limit_seconds: 10
client.champion
client.game
client.league
client.stats
client.summoner
client.team
client.champion.get
client.game.recent(summoner_id)
client.league.get(summoner_id)
client.stats.summary(summoner_id)
client.stats.ranked(summoner_id)
client.summoner.masteries(summoner_id)
client.summoner.runes(summoner_id)
client.summoner.by_name(name)
client.summoner.get(summoner_id)
client.summoner.name(summoner_ids)
client.team.get(summoner_id)
Making Static Requests
The Riot API has a section carved out for static-data. These requests don't count against your rate limit. The mechanism for using them is similar to the standard requests above.
Each static endpoint has two possible requests: get
and get(id)
. get
returns an array of OpenStructs representing the data from Riot's API, and get(id)
returns an OpenStruct with a single record. Here are some examples:
client.static
**NOTE**: StaticRequest is not meant to be used directly, but can be!
client.static.champion
client.static.champion.get
client.static.champion.get(id)
You can also pass query parameters as listed in the Riot API documentation. For example:
client.static.champion.get(champData: 'all')
client.static.champion.get(champData: 'lore')
NOTE: The realm endpoint is not implemented. Let us know if you need it, but it seemed somewhat unnecessary.
Contributing
- Fork it
- 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 new Pull Request
Changelog
- 0.9.14 Fixed a caching bug
- 0.9.13 Updated to latest API versions
- 0.9.12 Fixed a caching bug
- 0.9.11 Added caching support via REDIS
- 0.9.7 Updated LeagueRequest to API v2.3
- 0.9.6 Updated SummonerRequest and GameRequest to API v1.3
- 0.9.5 Fixed documentation
- 0.9.4 Completed support for updated API