Class: BotWebhook
- Inherits:
- 
      Object
      
        - Object
- BotWebhook
 
- Defined in:
- lib/telegram_bot_builder/bot_webhook.rb
Instance Method Summary collapse
Instance Method Details
#deleteWebhook ⇒ Object
| 28 29 30 | # File 'lib/telegram_bot_builder/bot_webhook.rb', line 28 def deleteWebhook setWebhook(nil, nil) end | 
#getWebhook ⇒ Object
| 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # File 'lib/telegram_bot_builder/bot_webhook.rb', line 32 def getWebhook method = 'getWebhookInfo' uri = URI.parse(BotAPI::URLBUIDER.build(method)) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) result = http.request(request) p result if result.code == '200' return BotAPI.parse(method, result.body) end end | 
#setWebhook(url, certificate) ⇒ Object
| 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # File 'lib/telegram_bot_builder/bot_webhook.rb', line 2 def setWebhook(url, certificate) method = 'setWebhook' params = {} if url != nil && certificate != nil params = { url: url, certificate: certificate } end uri = URI.parse(BotAPI::URLBUIDER.build(method)) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data(params) result = http.request(request) p result if result.code == '200' return BotAPI.parse(method, result.body) end end |