Class: Teleswagger::GamesApi
- Inherits:
-
Object
- Object
- Teleswagger::GamesApi
- Defined in:
- lib/teleswagger/api/games_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
- #get_game_high_scores(token, user_id, opts = {}) ⇒ InlineResponse2006
-
#get_game_high_scores_with_http_info(token, user_id, opts = {}) ⇒ Array<(InlineResponse2006, Fixnum, Hash)>
InlineResponse2006 data, response status code and response headers.
-
#initialize(api_client = ApiClient.default) ⇒ GamesApi
constructor
A new instance of GamesApi.
- #send_game(token, opts = {}) ⇒ ResponseMessage
-
#send_game_with_http_info(token, opts = {}) ⇒ Array<(ResponseMessage, Fixnum, Hash)>
ResponseMessage data, response status code and response headers.
- #set_game_score(token, user_id, score, opts = {}) ⇒ InlineResponse200
-
#set_game_score_with_http_info(token, user_id, score, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
InlineResponse200 data, response status code and response headers.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
28 29 30 |
# File 'lib/teleswagger/api/games_api.rb', line 28 def api_client @api_client end |
Instance Method Details
#get_game_high_scores(token, user_id, opts = {}) ⇒ InlineResponse2006
43 44 45 46 |
# File 'lib/teleswagger/api/games_api.rb', line 43 def get_game_high_scores(token, user_id, opts = {}) data, _status_code, _headers = get_game_high_scores_with_http_info(token, user_id, opts) return data end |
#get_game_high_scores_with_http_info(token, user_id, opts = {}) ⇒ Array<(InlineResponse2006, Fixnum, Hash)>
Returns InlineResponse2006 data, response status code and response headers.
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 |
# File 'lib/teleswagger/api/games_api.rb', line 57 def get_game_high_scores_with_http_info(token, user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GamesApi.get_game_high_scores ..." end # verify the required parameter 'token' is set fail ArgumentError, "Missing the required parameter 'token' when calling GamesApi.get_game_high_scores" if token.nil? # verify the required parameter 'user_id' is set fail ArgumentError, "Missing the required parameter 'user_id' when calling GamesApi.get_game_high_scores" if user_id.nil? # resource path local_var_path = "/bot{token}/getGameHighScores".sub('{format}','json').sub('{' + 'token' + '}', token.to_s) # query parameters query_params = {} query_params[:'user_id'] = user_id query_params[:'chat_id'] = opts[:'chat_id'] if !opts[:'chat_id'].nil? query_params[:'message_id'] = opts[:'message_id'] if !opts[:'message_id'].nil? query_params[:'inline_message_id'] = opts[:'inline_message_id'] if !opts[:'inline_message_id'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse2006') if @api_client.config.debugging @api_client.config.logger.debug "API called: GamesApi#get_game_high_scores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#send_game(token, opts = {}) ⇒ ResponseMessage
111 112 113 114 |
# File 'lib/teleswagger/api/games_api.rb', line 111 def send_game(token, opts = {}) data, _status_code, _headers = send_game_with_http_info(token, opts) return data end |
#send_game_with_http_info(token, opts = {}) ⇒ Array<(ResponseMessage, Fixnum, Hash)>
Returns ResponseMessage data, response status code and response headers.
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 |
# File 'lib/teleswagger/api/games_api.rb', line 122 def send_game_with_http_info(token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GamesApi.send_game ..." end # verify the required parameter 'token' is set fail ArgumentError, "Missing the required parameter 'token' when calling GamesApi.send_game" if token.nil? # resource path local_var_path = "/bot{token}/sendGame".sub('{format}','json').sub('{' + 'token' + '}', token.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ResponseMessage') if @api_client.config.debugging @api_client.config.logger.debug "API called: GamesApi#send_game\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#set_game_score(token, user_id, score, opts = {}) ⇒ InlineResponse200
176 177 178 179 |
# File 'lib/teleswagger/api/games_api.rb', line 176 def set_game_score(token, user_id, score, opts = {}) data, _status_code, _headers = set_game_score_with_http_info(token, user_id, score, opts) return data end |
#set_game_score_with_http_info(token, user_id, score, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
Returns InlineResponse200 data, response status code and response headers.
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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/teleswagger/api/games_api.rb', line 193 def set_game_score_with_http_info(token, user_id, score, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GamesApi.set_game_score ..." end # verify the required parameter 'token' is set fail ArgumentError, "Missing the required parameter 'token' when calling GamesApi.set_game_score" if token.nil? # verify the required parameter 'user_id' is set fail ArgumentError, "Missing the required parameter 'user_id' when calling GamesApi.set_game_score" if user_id.nil? # verify the required parameter 'score' is set fail ArgumentError, "Missing the required parameter 'score' when calling GamesApi.set_game_score" if score.nil? # resource path local_var_path = "/bot{token}/setGameScore".sub('{format}','json').sub('{' + 'token' + '}', token.to_s) # query parameters query_params = {} query_params[:'user_id'] = user_id query_params[:'score'] = score query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil? query_params[:'disable_edit_message'] = opts[:'disable_edit_message'] if !opts[:'disable_edit_message'].nil? query_params[:'chat_id'] = opts[:'chat_id'] if !opts[:'chat_id'].nil? query_params[:'message_id'] = opts[:'message_id'] if !opts[:'message_id'].nil? query_params[:'inline_message_id'] = opts[:'inline_message_id'] if !opts[:'inline_message_id'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' local_header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse200') if @api_client.config.debugging @api_client.config.logger.debug "API called: GamesApi#set_game_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |