Sha256: 8dfb8807c8d4f21e12e6774d44cae2dfdf82698c8a6519211c7433c2b16a54da
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
module Lolxin class MatchList BASE_ENDPOINT = "https://%s.api.pvp.net/api/lol/%s/%s/matchlist/by-summoner" #"/21421970" attr_accessor :conn def initialize(options = {}) region = options[:region] api_key = options[:api_key] version = options[:version] endpoint = BASE_ENDPOINT % [region, region, version] @conn = Faraday.new(endpoint, options[:conn_options]) do |faraday| faraday.request(:url_encoded) faraday.response(:logger) faraday.adapter(Faraday.default_adapter) faraday.params[:api_key] = api_key end end def by_summoner(params = {}, &block) summ_id = params.delete(:summonerId).to_s champ_ids = params.delete(:championIds) champ_ids = champ_ids.join(',') if champ_ids.is_a? Array ranked_queues = params.delete(:rankedQueues) ranked_queues = ranked_queues.map(&:upcase).join(',') if ranked_queues.is_a? Array seasons = params.delete(:seasons) seasons = seasons.map(&:upcase).join(',') if seasons.is_a? Array params[:championIds] = champ_ids params[:rankedQueues] = ranked_queues params[:seasons] = seasons conn.get(summ_id, params, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lolxin-0.12.1 | lib/lolxin/match_list.rb |