Class: RiotGamesApi::LOL::Resource::Team

Inherits:
Base
  • Object
show all
Defined in:
lib/riot_games_api/lol/resource/team.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, region) ⇒ Team

Returns a new instance of Team.



5
6
7
8
# File 'lib/riot_games_api/lol/resource/team.rb', line 5

def initialize(connection, region)
  super
  @version = 'v2.4'
end

Instance Method Details

#by_summoner_id(summoner_ids) ⇒ TeamList

Return team data by summoner id

Parameters:

  • summoner_ids (Array)

Returns:

  • (TeamList)


13
14
15
16
17
18
19
# File 'lib/riot_games_api/lol/resource/team.rb', line 13

def by_summoner_id(summoner_ids)
  neated_param = neat_params(summoner_ids)
  teams_by_player = get(resource_path(neated_param, true), @version)
  teams_by_player.map do |team|
    RiotGamesApi::LOL::Model::Team::TeamList.new(id: team.first, teams: team.last)
  end
end

#by_team_id(team_ids) ⇒ Array

Return team data by team id

Parameters:

  • team_ids (Array)

Returns:

  • (Array)

    team id => Team in Array



24
25
26
27
28
29
30
31
# File 'lib/riot_games_api/lol/resource/team.rb', line 24

def by_team_id(team_ids)
  neated_param = neat_params(team_ids)
  teams = get(resource_path(neated_param), @version)
  # team_key = team.keys.first.gsub(/team/, 'TEAM').gsub(/_/, '-') # undo rashify
  teams.map do |team|
    { team.first =>  RiotGamesApi::LOL::Model::Team::Team.new(team.last) }
  end
end