class RiotGamesApi::LOL::Resource::Summoner
Public Class Methods
new(connection, region)
click to toggle source
Calls superclass method
RiotGamesApi::LOL::Resource::Base::new
# File lib/riot_games_api/lol/resource/summoner.rb, line 5 def initialize(connection, region) super @version = 'v1.4' end
Public Instance Methods
by_id(summoner_ids)
click to toggle source
Return summoners data by summoner id @param [Array] summoner_ids summoner ids in array @return [Array] Summoner
models in Array
# File lib/riot_games_api/lol/resource/summoner.rb, line 24 def by_id(summoner_ids) neated_param = neat_params(summoner_ids) summoners = get(resource_path_by_id(neated_param), @version) summoners.map do |summoner| RiotGamesApi::LOL::Model::Summoner::Summoner.new(summoner.last) end end
by_name(summoner_names)
click to toggle source
Return summoners data by summoner name @param [Array] summoner_names summoner names in array @return [Array] Summoner
models in Array
# File lib/riot_games_api/lol/resource/summoner.rb, line 13 def by_name(summoner_names) neated_param = neat_params(summoner_names) summoners = get(resource_path_by_name(neated_param), @version) summoners.map do |summoner| RiotGamesApi::LOL::Model::Summoner::Summoner.new(summoner.last) end end
masteries(summoner_ids)
click to toggle source
Return summoner mastaries by summoner id @param [Array] summoner_ids summoner ids in Array @return [Array] MasteryPageList models in Array
# File lib/riot_games_api/lol/resource/summoner.rb, line 35 def masteries(summoner_ids) neated_param = neat_params(summoner_ids) masteries = get(resource_path_by_id('masteries', neated_param), @version) masteries.map do |mastery| RiotGamesApi::LOL::Model::Summoner::MasteryPageList.new(mastery.last) end # { masteries.keys.first.to_i => ) } end
name(summoner_ids)
click to toggle source
Return summoner names by summoner id @param [Array] summoner_ids summoner ids in Array @return [Array] Name models in Array
# File lib/riot_games_api/lol/resource/summoner.rb, line 47 def name(summoner_ids) neated_param = neat_params(summoner_ids) names = get(resource_path_by_id('name', neated_param), @version) names.map do |name| RiotGamesApi::LOL::Model::Summoner::Name.new(id: name.first, name: name.last) end end
runes(summoner_ids)
click to toggle source
Return summoner runes by summoner id @param [Array] summoner_ids summoner ids in Array @return [Array] RunePageList models in Array
# File lib/riot_games_api/lol/resource/summoner.rb, line 58 def runes(summoner_ids) neated_param = neat_params(summoner_ids) runes = get(resource_path_by_id('runes', neated_param), @version) runes.map do |rune| RiotGamesApi::LOL::Model::Summoner::RunePageList.new(rune.last) end end
Private Instance Methods
resource_path_by_id(path = nil, summoner_id)
click to toggle source
# File lib/riot_games_api/lol/resource/summoner.rb, line 72 def resource_path_by_id(path = nil, summoner_id) if path "summoner/#{summoner_id}/#{path}" else "summoner/#{summoner_id}" end end
resource_path_by_name(summoner_name)
click to toggle source
# File lib/riot_games_api/lol/resource/summoner.rb, line 68 def resource_path_by_name(summoner_name) "summoner/by-name/#{summoner_name}" end