class Teleswagger::GamesApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/teleswagger/api/games_api.rb, line 30
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_game_high_scores(token, user_id, opts = {}) click to toggle source

@param token bot's token to authorize the request @param user_id @param [Hash] opts the optional parameters @option opts [Integer] :chat_id @option opts [Integer] :message_id @option opts [String] :inline_message_id @return [InlineResponse2006]

# 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 = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param user_id @param [Hash] opts the optional parameters @option opts [Integer] :chat_id @option opts [Integer] :message_id @option opts [String] :inline_message_id @return [Array<(InlineResponse2006, Fixnum, Hash)>] InlineResponse2006 data, response status code and response headers

# 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 = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [SendGameBody] :body @return [ResponseMessage]

# 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 = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param [Hash] opts the optional parameters @option opts [SendGameBody] :body @return [Array<(ResponseMessage, Fixnum, Hash)>] ResponseMessage data, response status code and response headers

# 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 = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param user_id @param score @param [Hash] opts the optional parameters @option opts [BOOLEAN] :force @option opts [BOOLEAN] :disable_edit_message @option opts [Integer] :chat_id @option opts [Integer] :message_id @option opts [String] :inline_message_id @return [InlineResponse200]

# 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 = {}) click to toggle source

@param token bot&#39;s token to authorize the request @param user_id @param score @param [Hash] opts the optional parameters @option opts [BOOLEAN] :force @option opts [BOOLEAN] :disable_edit_message @option opts [Integer] :chat_id @option opts [Integer] :message_id @option opts [String] :inline_message_id @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers

# 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