Class: ChampionModule
- Inherits:
-
SightstoneBaseModule
- Object
- SightstoneBaseModule
- ChampionModule
- Defined in:
- lib/sightstone/modules/champion_module.rb
Instance Method Summary collapse
- #champions(optional = {}) ⇒ Object
-
#initialize(sightstone) ⇒ ChampionModule
constructor
A new instance of ChampionModule.
Constructor Details
#initialize(sightstone) ⇒ ChampionModule
Returns a new instance of ChampionModule.
6 7 8 |
# File 'lib/sightstone/modules/champion_module.rb', line 6 def initialize(sightstone) @sightstone = sightstone end |
Instance Method Details
#champions(optional = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sightstone/modules/champion_module.rb', line 10 def champions(optional={}) region = optional[:region] || @sightstone.region free_to_play = optional[:free_to_play] uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.1/champion" response = _get_api_response(uri, {'freeToPlay' => free_to_play}) puts response _parse_response(response) { |resp| data = JSON.parse(resp) champions = [] data['champions'].each do |champ| champions << Champion.new(champ) end return champions } end |