Class: RubyVibe::Bot
Overview
Set of predefined viber api requests. This class is used directly by user. Define constants for configuration settings, or add them on initialization.
Instance Attribute Summary
Attributes inherited from Client
#avatar, #name, #payload_hash, #response, #token
Instance Method Summary collapse
-
#broadcast_message(opts = {}) ⇒ Hash
Broadcast message to multiple users.
- #get_account_info ⇒ Object
- #get_online(*user_ids) ⇒ Object
- #get_user_details(user_id) ⇒ Object
-
#initialize(token: nil, name: nil, avatar: nil) ⇒ Bot
constructor
Bot object to work with.
-
#send_message(opts = {}) ⇒ Hash
Send message to user.
- #set_webhook(opts = {}) ⇒ Object
Constructor Details
#initialize(token: nil, name: nil, avatar: nil) ⇒ Bot
Returns Bot object to work with.
28 29 30 31 32 33 34 |
# File 'lib/ruby-vibe/bot.rb', line 28 def initialize(token: nil, name: nil, avatar: nil) token ||= RubyVibe::TOKEN name ||= RubyVibe::NAME avatar ||= RubyVibe::AVATAR super(token: token, name: name, avatar: avatar) end |
Instance Method Details
#broadcast_message(opts = {}) ⇒ Hash
Broadcast message to multiple users.
70 71 72 |
# File 'lib/ruby-vibe/bot.rb', line 70 def (opts = {}) viberize(URL::BROADCAST_MESSAGE, opts) end |
#get_account_info ⇒ Object
84 85 86 |
# File 'lib/ruby-vibe/bot.rb', line 84 def get_account_info viberize(URL::GET_ACCOUNT_INFO, info: true) end |
#get_online(*user_ids) ⇒ Object
98 99 100 |
# File 'lib/ruby-vibe/bot.rb', line 98 def get_online(*user_ids) viberize(URL::GET_ONLINE, ids: Array(user_ids), info: true) end |
#get_user_details(user_id) ⇒ Object
91 92 93 |
# File 'lib/ruby-vibe/bot.rb', line 91 def get_user_details(user_id) viberize(URL::GET_USER_DETAILS, id: user_id, info: true) end |
#send_message(opts = {}) ⇒ Hash
Send message to user.
51 52 53 |
# File 'lib/ruby-vibe/bot.rb', line 51 def (opts = {}) viberize(URL::SEND_MESSAGE, opts) end |
#set_webhook(opts = {}) ⇒ Object
77 78 79 |
# File 'lib/ruby-vibe/bot.rb', line 77 def set_webhook(opts = {}) viberize(URL::SET_WEBHOOK, opts) end |