Class: Lol::ChampionRequest
- Defined in:
- lib/lol/champion_request.rb
Instance Attribute Summary
Attributes inherited from Request
#api_key, #cache_store, #region
Class Method Summary collapse
-
.api_version ⇒ String
Returns the supported API Version.
Instance Method Summary collapse
-
#get(options = {}) ⇒ Array
Retrieve all champions.
Methods inherited from Request
#api_base_url, #api_query_string, #api_url, #cached?, #clean_url, #initialize, #perform_request, #post_api_url, #store, #ttl
Constructor Details
This class inherits a constructor from Lol::Request
Class Method Details
.api_version ⇒ String
Returns the supported API Version
5 6 7 |
# File 'lib/lol/champion_request.rb', line 5 def self.api_version "v1.2" end |
Instance Method Details
#get(options = {}) ⇒ Array
Retrieve all champions
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lol/champion_request.rb', line 14 def get = {} champion_id = .delete :id free_to_play = .delete(:free_to_play) ? true : false url = champion_id ? "champion/#{champion_id}" : "champion" result = perform_request(api_url(url, "freeToPlay" => free_to_play)) if champion_id Champion.new(result) else result["champions"].map {|c| Champion.new(c)} end end |