Class: Viberroo::Bot
Instance Method Summary collapse
-
#initialize(token:, response: {}) ⇒ Bot
constructor
A new instance of Bot.
- #remove_webhook ⇒ Object
- #set_webhook(params) ⇒ Object
Methods included from Message
#send_contact, #send_file, #send_location, #send_message, #send_picture, #send_rich_media, #send_sticker, #send_url, #send_video
Constructor Details
#initialize(token:, response: {}) ⇒ Bot
Returns a new instance of Bot.
5 6 7 8 9 10 |
# File 'lib/viberroo/bot.rb', line 5 def initialize(token:, response: {}) @webhook_url = "#{API_URL}/set_webhook" @message_url = "#{API_URL}/send_message" @headers = { 'X-Viber-Auth-Token': token, 'Content-Type': 'application/json' } @response = response end |
Instance Method Details
#remove_webhook ⇒ Object
16 17 18 |
# File 'lib/viberroo/bot.rb', line 16 def remove_webhook Faraday.post(@webhook_url, { url: '' }.to_json, @headers) end |
#set_webhook(params) ⇒ Object
12 13 14 |
# File 'lib/viberroo/bot.rb', line 12 def set_webhook(params) Faraday.post(@webhook_url, params.to_json, @headers) end |