Class: Viberroo::Bot
- Inherits:
-
Object
show all
- Includes:
- Message
- Defined in:
- lib/viberroo/bot.rb
Instance Method Summary
collapse
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
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"
= { '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, )
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, )
end
|