class VkLongpollBot::Events::Event
Class containing data received from longpoll. Provides easy access to it's data.
Attributes
bot[R]
@return [Bot] longpoll bot which received event.
data[R]
@return [Hash] hash with updates data.
group_id[R]
@return [Integer] ID of group which received event.
subtype[R]
@return [String] subtype of event.
Public Class Methods
new(subtype, data, group_id, bot)
click to toggle source
New event. Initialize from fields of update json and bot which got this event.
@param subtype [String] @param data [Hash] update
array entry. @param group_id
[Integer] @param bot [Bot]
# File lib/vk_longpoll_bot/events.rb, line 59 def initialize(subtype, data, group_id, bot) @subtype = subtype.to_s @data = data @group_id = group_id.to_i @bot = bot end
Public Instance Methods
[](arg)
click to toggle source
Provides access to fields of update data.
@param arg [String] hash key.
@return [Object]
# File lib/vk_longpoll_bot/events.rb, line 72 def [](arg) @data[arg.to_s] end