Class: Twitch::V2::Games
- Inherits:
-
Object
- Object
- Twitch::V2::Games
- Defined in:
- lib/kappa/game.rb
Overview
Query class for finding top games or finding games by name.
Instance Method Summary collapse
-
#find(options) {|suggestion| ... } ⇒ Array<GameSuggestion>?
Get a list of games with names similar to the specified name.
-
#top(options = {}) {|game| ... } ⇒ Array<Game>?
Get a list of games with the highest number of current viewers on Twitch.
Instance Method Details
#find(options) {|suggestion| ... } ⇒ Array<GameSuggestion>?
Get a list of games with names similar to the specified name.
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/kappa/game.rb', line 194 def find() raise ArgumentError, 'options' if .nil? raise ArgumentError, 'name' if [:name].nil? params = { :query => [:name], :type => 'suggest' } if [:live] params.merge!(:live => true) end return @query.connection.accumulate( :path => 'search/games', :params => params, :json => 'games', :create => GameSuggestion, :limit => [:limit] ) end |
#top(options = {}) {|game| ... } ⇒ Array<Game>?
Get a list of games with the highest number of current viewers on Twitch.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/kappa/game.rb', line 155 def top( = {}, &block) params = {} if [:hls] params[:hls] = true end return @query.connection.accumulate( :path => 'games/top', :params => params, :json => 'top', :create => -> hash { Game.new(hash, @query) }, :limit => [:limit], :offset => [:offset], &block ) end |