Class: VkLongpollBot::Events::Event
- Inherits:
-
Object
- Object
- VkLongpollBot::Events::Event
- Defined in:
- lib/vk_longpoll_bot/events.rb
Overview
Class containing data recieved from longpoll. Provides easy update to it’s data.
Instance Attribute Summary collapse
-
#bot ⇒ Object
readonly
Returns the value of attribute bot.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#group_id ⇒ Object
readonly
Returns the value of attribute group_id.
-
#subtype ⇒ Object
readonly
Returns the value of attribute subtype.
Instance Method Summary collapse
-
#[](arg) ⇒ Object
Provides access to fields of update data.
-
#initialize(subtype, data, group_id, bot) ⇒ Event
constructor
Initialize from fields of update json and bot which got this event.
Constructor Details
#initialize(subtype, data, group_id, bot) ⇒ Event
Initialize from fields of update json and bot which got this event.
32 33 34 35 36 37 |
# File 'lib/vk_longpoll_bot/events.rb', line 32 def initialize(subtype, data, group_id, bot) @subtype = subtype.to_s @data = data @group_id = group_id.to_i @bot = bot end |
Instance Attribute Details
#bot ⇒ Object (readonly)
Returns the value of attribute bot.
29 30 31 |
# File 'lib/vk_longpoll_bot/events.rb', line 29 def bot @bot end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
29 30 31 |
# File 'lib/vk_longpoll_bot/events.rb', line 29 def data @data end |
#group_id ⇒ Object (readonly)
Returns the value of attribute group_id.
29 30 31 |
# File 'lib/vk_longpoll_bot/events.rb', line 29 def group_id @group_id end |
#subtype ⇒ Object (readonly)
Returns the value of attribute subtype.
29 30 31 |
# File 'lib/vk_longpoll_bot/events.rb', line 29 def subtype @subtype end |
Instance Method Details
#[](arg) ⇒ Object
Provides access to fields of update data.
40 41 42 |
# File 'lib/vk_longpoll_bot/events.rb', line 40 def [](arg) @data[arg.to_s] end |