Class: Lolxin::Spectator
Defined Under Namespace
Classes: BannedChampion, CurrentGameParticipant, FeaturedGames, Mastery, Observer, Participant, Rune
Constant Summary collapse
- CurrentGameInfo =
FeaturedGameInfo = Struct.new( :game_id, :game_start_time, :platform_id, :game_mode, :map_id, :game_type, :banned_champions, :observers, :participants, :game_length, :game_queue_config_id )
Constants inherited from Api
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
Attributes inherited from Api
#api_key, #conn, #region, #version
Instance Method Summary collapse
- #by_summoner(summoner_id) ⇒ Object
- #featured_games ⇒ Object
-
#initialize(options = {}) ⇒ Spectator
constructor
A new instance of Spectator.
Constructor Details
#initialize(options = {}) ⇒ Spectator
Returns a new instance of Spectator.
67 68 69 70 |
# File 'lib/lolxin/api/spectator.rb', line 67 def initialize( = {}) super @endpoint = "spectator/%{version}" % {version: @version} end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
65 66 67 |
# File 'lib/lolxin/api/spectator.rb', line 65 def endpoint @endpoint end |
Instance Method Details
#by_summoner(summoner_id) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/lolxin/api/spectator.rb', line 72 def by_summoner(summoner_id) url = "#{endpoint}/active-games/by-summoner/#{summoner_id}" res = conn.get(url) return res if res.status != 200 current_game = JSON.parse(res.body) build_current_game_info(current_game) end |
#featured_games ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/lolxin/api/spectator.rb', line 81 def featured_games url = "#{endpoint}/featured-games" res = conn.get(url) return res if res.status != 200 featured = JSON.parse(res.body) build_featured_games(featured) end |