updated summoner.names to v1.3

This commit is contained in:
danijoo
2014-03-14 15:17:19 +01:00
parent 4bb935994b
commit e3a17d578f
2 changed files with 6 additions and 6 deletions

View File

@@ -75,14 +75,14 @@ class SummonerModule < SightstoneBaseModule
def names(ids, optional={}) def names(ids, optional={})
region = optional[:region] || @sightstone.region region = optional[:region] || @sightstone.region
ids = ids.join(',') ids = ids.join(',')
uri = "http://prod.api.pvp.net/api/lol/#{region}/v1.2/summoner/#{ids}/name" uri = "http://prod.api.pvp.net/api/lol/#{region}/v1.3/summoner/#{ids}/name"
response = _get_api_response(uri) response = _get_api_response(uri)
_parse_response(response) { |resp| _parse_response(response) { |resp|
data = JSON.parse(resp) data = JSON.parse(resp)
names_array = data['summoners']
names_hash = Hash.new names_hash = Hash.new
names_array.each do |summoner| data.each do |id, name|
names_hash[summoner['id']] = summoner['name'] names_hash[id.to_i] = name
end end
if block_given? if block_given?
yield names_hash yield names_hash

View File

@@ -1,7 +1,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = 'sightstone' s.name = 'sightstone'
s.version = '1.4.1' s.version = '1.4.2'
s.date = '2014-01-17' s.date = '2014-03-14'
s.summary = 'Ruby wrapper for riots league of legends api' s.summary = 'Ruby wrapper for riots league of legends api'
s.description = s.summary s.description = s.summary
s.authors = ["Daniel Bauer"] s.authors = ["Daniel Bauer"]