Class: Lol::ChampionRequest
- Defined in:
- lib/lol/champion_request.rb
Overview
Bindings for the Champion API.
Instance Attribute Summary
Attributes inherited from Request
#api_key, #cache_store, #rate_limiter, #region
Instance Method Summary collapse
-
#all(free_to_play: false) ⇒ Array<Lol::DynamicModel>
Retrieve all champions.
-
#find(id) ⇒ Lol::DynamicModel
Retrieve champion by ID.
Methods inherited from Request
#api_base_path, #api_base_url, #api_query_string, #api_url, #api_version, api_version, #cached?, #clean_url, #initialize, #perform_rate_limited_request, #perform_request, #perform_uncached_request, #platform, platforms, #store, #ttl
Constructor Details
This class inherits a constructor from Lol::Request
Instance Method Details
#all(free_to_play: false) ⇒ Array<Lol::DynamicModel>
Retrieve all champions
See: developer.riotgames.com/api-methods/#champion-v3/GET_getChampions
11 12 13 14 |
# File 'lib/lol/champion_request.rb', line 11 def all free_to_play: false result = perform_request api_url("champions", "freeToPlay" => free_to_play) result["champions"].map { |c| DynamicModel.new c } end |
#find(id) ⇒ Lol::DynamicModel
Retrieve champion by ID
See: developer.riotgames.com/api-methods/#champion-v3/GET_getChampionsById
21 22 23 24 |
# File 'lib/lol/champion_request.rb', line 21 def find id result = perform_request api_url "champions/#{id}" DynamicModel.new result end |