Class: Lishogi::TVApi
- Inherits:
-
Object
- Object
- Lishogi::TVApi
- Defined in:
- lib/lishogi/api/tv_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ TVApi
constructor
A new instance of TVApi.
-
#tv_channel_games(channel, opts = {}) ⇒ Object
Get best ongoing games of a TV channel Get a list of ongoing games for a given TV channel.
-
#tv_channel_games_with_http_info(channel, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Get best ongoing games of a TV channel Get a list of ongoing games for a given TV channel.
-
#tv_channels(opts = {}) ⇒ Object
Get current TV games Get basic info about the best games being played for each speed and variant, but also computer games and bot games.
-
#tv_channels_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Get current TV games Get basic info about the best games being played for each speed and variant, but also computer games and bot games.
-
#tv_feed(opts = {}) ⇒ Object
Stream current TV game Stream positions and moves of the current [TV game](lishogi.org/tv) in [ndjson](#section/Introduction/Streaming-with-ND-JSON).
-
#tv_feed_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Stream current TV game Stream positions and moves of the current [TV game](lishogi.org/tv) in [ndjson](#section/Introduction/Streaming-with-ND-JSON).
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/lishogi/api/tv_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#tv_channel_games(channel, opts = {}) ⇒ Object
Get best ongoing games of a TV channel Get a list of ongoing games for a given TV channel. Similar to [lishogi.org/games](lishogi.org/games). Available in kifu or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format, depending on the request Accept header.
32 33 34 35 |
# File 'lib/lishogi/api/tv_api.rb', line 32 def tv_channel_games(channel, opts = {}) data, _status_code, _headers = tv_channel_games_with_http_info(channel, opts) data end |
#tv_channel_games_with_http_info(channel, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Get best ongoing games of a TV channel Get a list of ongoing games for a given TV channel. Similar to [lishogi.org/games](lishogi.org/games). Available in kifu or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format, depending on the request Accept header.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/lishogi/api/tv_api.rb', line 47 def tv_channel_games_with_http_info(channel, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TVApi.tv_channel_games ...' end # verify the required parameter 'channel' is set if @api_client.config.client_side_validation && channel.nil? fail ArgumentError, "Missing the required parameter 'channel' when calling TVApi.tv_channel_games" end if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] > 30 fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling TVApi.tv_channel_games, must be smaller than or equal to 30.' end if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] < 1 fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling TVApi.tv_channel_games, must be greater than or equal to 1.' end # resource path local_var_path = '/api/tv/{channel}'.sub('{' + 'channel' + '}', CGI.escape(channel.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'nb'] = opts[:'nb'] if !opts[:'nb'].nil? query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil? query_params[:'notationInJson'] = opts[:'notation_in_json'] if !opts[:'notation_in_json'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/x-ndjson']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"TVApi.tv_channel_games", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TVApi#tv_channel_games\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#tv_channels(opts = {}) ⇒ Object
Get current TV games Get basic info about the best games being played for each speed and variant, but also computer games and bot games. See [lishogi.org/tv](lishogi.org/tv).
112 113 114 115 |
# File 'lib/lishogi/api/tv_api.rb', line 112 def tv_channels(opts = {}) data, _status_code, _headers = tv_channels_with_http_info(opts) data end |
#tv_channels_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Get current TV games Get basic info about the best games being played for each speed and variant, but also computer games and bot games. See [lishogi.org/tv](lishogi.org/tv).
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/lishogi/api/tv_api.rb', line 121 def tv_channels_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TVApi.tv_channels ...' end # resource path local_var_path = '/api/tv/channels' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"TVApi.tv_channels", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TVApi#tv_channels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#tv_feed(opts = {}) ⇒ Object
Stream current TV game Stream positions and moves of the current [TV game](lishogi.org/tv) in [ndjson](#section/Introduction/Streaming-with-ND-JSON). A summary of the game is sent as a first message, and when the featured game changes. Try it with ‘curl lishogi.org/api/tv/feed`.
169 170 171 172 |
# File 'lib/lishogi/api/tv_api.rb', line 169 def tv_feed(opts = {}) data, _status_code, _headers = tv_feed_with_http_info(opts) data end |
#tv_feed_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Stream current TV game Stream positions and moves of the current [TV game](lishogi.org/tv) in [ndjson](#section/Introduction/Streaming-with-ND-JSON). A summary of the game is sent as a first message, and when the featured game changes. Try it with `curl lishogi.org/api/tv/feed`.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/lishogi/api/tv_api.rb', line 178 def tv_feed_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TVApi.tv_feed ...' end # resource path local_var_path = '/api/tv/feed' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"TVApi.tv_feed", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TVApi#tv_feed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |