lib/taric/operation/league.rb in taric-0.3.1 vs lib/taric/operation/league.rb in taric-0.3.3

- old
+ new

@@ -11,41 +11,84 @@ LEAGUES_BY_SUMMONER_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-summoner/{summonerIds}{?api_key}" ENTRIES_BY_SUMMONER_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-summoner/{summonerIds}/entry{?api_key}" LEAGUES_BY_TEAM_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-team/{teamIds}{?api_key}" ENTRIES_BY_TEAM_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-team/{teamIds}/entry{?api_key}" CHALLENGER = Addressable::Template.new "#{BASE_LEAGUE_URL}/challenger{?api_key,type}" + MASTER = Addressable::Template.new "#{BASE_LEAGUE_URL}/master{?api_key,type}" CHALLENGER_QUEUE_TYPES = ['RANKED_SOLO_5x5'.freeze, 'RANKED_TEAM_3x3'.freeze, 'RANKED_TEAM_5x5'.freeze].freeze + MASTER_QUEUE_TYPES = CHALLENGER_QUEUE_TYPES - # @see https://developer.riotgames.com/api/methods#!/936/3241 + # Leagues by summoner IDs. + # + # @see https://developer.riotgames.com/api/methods#!/985/3351 + # @param summoner_ids summoner_ids [String] comma separated list of summoner ids + # @return [Hash] leagues keyed by summoner ids + # + # @example + # result = client.leagues_by_summoner_ids(summoner_ids: '21066,38877656') + # leagues = result['21066'] + # entries = first_summoner_leagues.first['entries'] def leagues_by_summoner_ids(summoner_ids:) response_for LEAGUES_BY_SUMMONER_IDS, {summonerIds: summoner_ids} end - # @see https://developer.riotgames.com/api/methods#!/936/3245 + # League entries by summoner IDs. + # + # @see https://developer.riotgames.com/api/methods#!/985/3351 + # @param summoner_ids summoner_ids [String] comma separated list of summoner ids + # @return [Hash] league entries keyed by summoner_ids + # + # @example + # result = client.league_entries_by_summoner_ids(summoner_ids: '21066,38877656') + # entries = result['38877656'] + # entry = entries.first + # entry_name = entry['name'] + # entry_tier = entry['tier'] def league_entries_by_summoner_ids(summoner_ids:) response_for ENTRIES_BY_SUMMONER_IDS, {summonerIds: summoner_ids} end - # @see https://developer.riotgames.com/api/methods#!/936/3242 + # Leagues by team IDs. + # + # @see https://developer.riotgames.com/api/methods#!/985/3352 + # @param team_ids team_ids [String] comma separated list of team ids + # @return [Hash] leagues keyed by team_ids def leagues_by_team_ids(team_ids:) response_for LEAGUES_BY_TEAM_IDS, {teamIds: team_ids} end - # @see https://developer.riotgames.com/api/methods#!/936/3244 + # League entries by team IDs. + # + # @see https://developer.riotgames.com/api/methods#!/985/3355 + # @param team_ids team_ids [String] comma separated list of team ids + # @return [Hash] league entries keyed by team_ids def league_entries_by_team_ids(team_ids:) response_for ENTRIES_BY_TEAM_IDS, {teamIds: team_ids} end - # Challenger league data for type. + # Challenger league data for queue type. # # @param type [String] required, must be RANKED_SOLO_5x5, RANKED_TEAM_3x3, or RANKED_TEAM_5x5 - # @see https://developer.riotgames.com/api/methods#!/936/3243 + # @return [Hash] challenger league data + # @see https://developer.riotgames.com/api/methods#!/985/3353 def challenger(type: ) raise ArgumentError, "Invalid argument: #{type}, arg must be in #{CHALLENGER_QUEUE_TYPES}" unless CHALLENGER_QUEUE_TYPES.include?(type) response_for CHALLENGER, {type: type} + end + + # Master league data for queue type. + # + # @param type [String] required, must be RANKED_SOLO_5x5, RANKED_TEAM_3x3, or RANKED_TEAM_5x5 + # @return [Hash] master league data + # https://developer.riotgames.com/api/methods#!/985/3354 + def master(type: ) + raise ArgumentError, + "Invalid argument: #{type}, arg must be in #{MASTER_QUEUE_TYPES}" unless MASTER_QUEUE_TYPES.include?(type) + + response_for MASTER, {type: type} end end end end \ No newline at end of file