Class: Teleswagger::CallbacksApi

Inherits:
Object
  • Object
show all
Defined in:
lib/teleswagger/api/callbacks_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CallbacksApi

Returns a new instance of CallbacksApi.



19
20
21
# File 'lib/teleswagger/api/callbacks_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/teleswagger/api/callbacks_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#answer_callback_query(token, callback_query_id, text, show_alert, url, cache_time, opts = {}) ⇒ ResponseBool

Parameters:

  • token

    bot's token to authorize the request

  • callback_query_id
  • text
  • show_alert
  • url
  • cache_time
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



33
34
35
36
# File 'lib/teleswagger/api/callbacks_api.rb', line 33

def answer_callback_query(token, callback_query_id, text, show_alert, url, cache_time, opts = {})
  data, _status_code, _headers = answer_callback_query_with_http_info(token, callback_query_id, text, show_alert, url, cache_time, opts)
  return data
end

#answer_callback_query_with_http_info(token, callback_query_id, text, show_alert, url, cache_time, opts = {}) ⇒ Array<(ResponseBool, Fixnum, Hash)>

Returns ResponseBool data, response status code and response headers.

Parameters:

  • token

    bot&#39;s token to authorize the request

  • callback_query_id
  • text
  • show_alert
  • url
  • cache_time
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResponseBool, Fixnum, Hash)>)

    ResponseBool data, response status code and response headers



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
107
108
109
110
111
# File 'lib/teleswagger/api/callbacks_api.rb', line 48

def answer_callback_query_with_http_info(token, callback_query_id, text, show_alert, url, cache_time, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CallbacksApi.answer_callback_query ..."
  end
  # verify the required parameter 'token' is set
  if @api_client.config.client_side_validation && token.nil?
    fail ArgumentError, "Missing the required parameter 'token' when calling CallbacksApi.answer_callback_query"
  end
  # verify the required parameter 'callback_query_id' is set
  if @api_client.config.client_side_validation && callback_query_id.nil?
    fail ArgumentError, "Missing the required parameter 'callback_query_id' when calling CallbacksApi.answer_callback_query"
  end
  # verify the required parameter 'text' is set
  if @api_client.config.client_side_validation && text.nil?
    fail ArgumentError, "Missing the required parameter 'text' when calling CallbacksApi.answer_callback_query"
  end
  # verify the required parameter 'show_alert' is set
  if @api_client.config.client_side_validation && show_alert.nil?
    fail ArgumentError, "Missing the required parameter 'show_alert' when calling CallbacksApi.answer_callback_query"
  end
  # verify the required parameter 'url' is set
  if @api_client.config.client_side_validation && url.nil?
    fail ArgumentError, "Missing the required parameter 'url' when calling CallbacksApi.answer_callback_query"
  end
  # verify the required parameter 'cache_time' is set
  if @api_client.config.client_side_validation && cache_time.nil?
    fail ArgumentError, "Missing the required parameter 'cache_time' when calling CallbacksApi.answer_callback_query"
  end
  # resource path
  local_var_path = "/bot{token}/answerCallbackQuery".sub('{' + 'token' + '}', token.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["callback_query_id"] = callback_query_id
  form_params["text"] = text
  form_params["show_alert"] = show_alert
  form_params["url"] = url
  form_params["cache_time"] = cache_time

  # http body (model)
  post_body = nil
  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 => 'ResponseBool')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CallbacksApi#answer_callback_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end