I had plan to update this gem, but Riot released irregular, not friendly endpoint for champion mastery. Due to this, I decide I will not maintenance after now.
So this gem support for champion, game, league, static-data, stats, summoner, team api. I think this gem is useful yet for collecting static-data.
Make access easy to access Riot Games API to get their game data for League of Legends.
Add this line to your application's Gemfile:
gem 'riot_games_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install riot_games_api
First, You should love to play, watch, or do something with League of Legends.
Very thanks to Riot for greatest game.
-
English
- You need to get your RIOT Games API key. You may need to register your app. Defaul key for development is too restricted to use.
-
Japanese
- RIOT Games API キーを取得してきて下さい。アプリケーションを登録してキーをもらったほうが良いかもしれません。デフォルトの開発用キーは普通に使うには制限が強すぎます。
https://developer.riotgames.com/
client = RiotGamesApi::LOL::Client.new api_key: 'your_api_key' # or ENV['RIOT_GAMES_API_KEY']
# * English
# avalable parameters when initialize client
# * Japanese
# クライアント初期化の際に使えるパラメータ
# api_key default: none or ENV['RIOT_GAMES_API_KEY']
# region default: 'na'
# adapter default: Faraday.default_adapter
# debug logging default: false
# locale default: 'en_US'
# from summoner resource
summoner = client.summoner.by_name ['hello im shishi'].first
# from team resource
teams = client.team.by_summoner_id [summoner.id]
# English
# You can use champions and items id list (created 2015/11/16)
# You can see and edit lists in lib/riot_games_api/lol/constant/
# Japnese
# チャンピオンとアイテムのIDのリストを作ってあります (2015/11/16 作成)
# lib/riot_games_api/lol/constant/ にファイルがあるので編集もできます
# from static_data resource
jinx = client.static_data.champion_by_id RiotGamesApi::LOL::CHAMPIONS[:jinx]
jinx_lore = jinx.lore
b_f_sword = client.static_data.item_by_id RiotGamesApi::LOL::ITEMS[:b_f_sword]
b_f_sword_stats = b_f_sword.stats
# English
# Now, Riot Games API do not support image file directly, but you can get url for images their official data. Almost same for items, etc.
# Japanese
# 現在 Riot Games API は画像を直接サポートしていませんが、こうするとCDNの公式データを取得するURLを組み立てることが出来ます。アイテムとかでも大体同じようにできます。
xin = client.static_data.champion_by_id RiotGamesApi::LOL::CHAMPIONS[:xin_zhao]
xin_image_filename = xin.image.full
image_group = xin.image.group
realm = client.static_data.realm
url = realm.cdn
dd_version = realm.dd
image_url = url + dd_version + '/img/' + image_group + xin_image_filename
- Fork it ( http://github.com//riot_games_api/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 new Pull Request