fixed, documentation and update to team module

This commit is contained in:
danijoo
2014-01-01 19:35:09 +01:00
parent e3a0e74b2f
commit 9ada2f659c
2 changed files with 54 additions and 11 deletions

View File

@@ -2,11 +2,16 @@ require 'sightstone/modules/sightstone_base_module'
require 'sightstone/summoner'
require 'sightstone/team'
# module to make calls to the team api
class TeamModule < SightstoneBaseModule
def initialize(sightstone)
@sightstone = sightstone
end
# call to receive all teams for a summoner
# @param [Summoner, Fixnum] summoner summoner object or id of a summoner
# @param optional [Hash] optional arguments: :region => replaces default region
# @ return [Array<Team>] An array containing all teams of the given summoner
def teams(summoner, optional={})
region = optional[:region] || @sightstone.region
id = if summoner.is_a? Summoner
@@ -15,7 +20,7 @@ class TeamModule < SightstoneBaseModule
summoner
end
uri = "https://prod.api.pvp.net/api/#{region}/v2.1/team/by-summoner/#{id}"
uri = "https://prod.api.pvp.net/api/lol/#{region}/v2.2/team/by-summoner/#{id}"
response = _get_api_response(uri)
_parse_response(response) { |resp|