champions api: rdoc, tests, removed debug strings

This commit is contained in:
danijoo
2013-12-30 15:31:20 +01:00
parent 2db43a21e5
commit 2f391f8f69
3 changed files with 47 additions and 1 deletions

View File

@@ -1,18 +1,21 @@
require 'sightstone/champion'
require 'sightstone/modules/sightstone_base_module'
# Module to provide calls to the summoner api
class ChampionModule < SightstoneBaseModule
def initialize(sightstone)
@sightstone = sightstone
end
# call to get champions
# @param optional [Hash] optional arguments: :region => replaces default region, :free_to_play => boolean (only free to play champs if true)
# @return [Array<Champion>] array of champs
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)