Class: RiotGamesApi::LOL::Resource::Team
- Defined in:
- lib/riot_games_api/lol/resource/team.rb
Instance Method Summary collapse
- #by_summoner_id(summoner_id) ⇒ Object
- #by_team_id(team_id) ⇒ Object
-
#initialize(connection, region) ⇒ Team
constructor
A new instance of Team.
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.2' end |
Instance Method Details
#by_summoner_id(summoner_id) ⇒ Object
10 11 12 13 14 |
# File 'lib/riot_games_api/lol/resource/team.rb', line 10 def by_summoner_id(summoner_id) get(resource_path(summoner_id, true), @version).map do |team| RiotGamesApi::LOL::Model::Team::Team.new team end end |
#by_team_id(team_id) ⇒ Object
16 17 18 19 20 |
# File 'lib/riot_games_api/lol/resource/team.rb', line 16 def by_team_id(team_id) team = get(resource_path(team_id), @version) team_key = team.keys.first.gsub(/team/, 'TEAM').gsub(/_/, '-') # undo rashify { team_key => RiotGamesApi::LOL::Model::Team::Team.new(team.values.first) } end |