Class: RubyGg::Challenger
- Inherits:
-
Object
- Object
- RubyGg::Challenger
- Defined in:
- lib/ruby_gg/challenger.rb
Instance Attribute Summary collapse
-
#challenger_url ⇒ Object
readonly
Returns the value of attribute challenger_url.
Instance Method Summary collapse
-
#initialize(api_key, region) ⇒ Challenger
constructor
Initializing the Challenger Instance.
-
#solo_queue(size = 0) ⇒ Object
Not passing an argument / passing string (unless string is number)/ 0 => returns all 200 results.
Constructor Details
#initialize(api_key, region) ⇒ Challenger
Initializing the Challenger Instance.
8 9 10 11 12 13 |
# File 'lib/ruby_gg/challenger.rb', line 8 def initialize(api_key, region) #Initializing the Challenger Instance. @api_key = api_key @region = region @base_url = "https://#{@region}.api.riotgames.com" @challenger_url = "/lol/league/v3/challengerleagues/by-queue/" end |
Instance Attribute Details
#challenger_url ⇒ Object (readonly)
Returns the value of attribute challenger_url.
6 7 8 |
# File 'lib/ruby_gg/challenger.rb', line 6 def challenger_url @challenger_url end |
Instance Method Details
#solo_queue(size = 0) ⇒ Object
Not passing an argument / passing string (unless string is number)/ 0 => returns all 200 results.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_gg/challenger.rb', line 15 def solo_queue (size = 0) # Not passing an argument / passing string (unless string is number)/ 0 => returns all 200 results. payCheck = (HTTParty.get("#{@base_url}#{@challenger_url}RANKED_SOLO_5x5?api_key=#{@api_key}").parsed_response)['entries'] if size.to_i == 0 || size.to_i >200 size = payCheck.size else size = size.to_i end payLoad = [] payCheck.sort!{|x, y| y['leaguePoints'] <=> x['leaguePoints']} (0...size).each {|x| payLoad.push(player_dto(payCheck[x]))} return payLoad end |