Class: BotMob::InboundMessage
- Inherits:
-
Object
- Object
- BotMob::InboundMessage
- Defined in:
- lib/bot_mob/inbound_message.rb
Overview
## BotMob::Inbound Message
The InboundMessage class provides easy access to messages received from Slack’s Real Time API
Instance Attribute Summary collapse
-
#bot_id ⇒ Object
readonly
Returns the value of attribute bot_id.
-
#channel_id ⇒ Object
readonly
Returns the value of attribute channel_id.
-
#channel_name ⇒ Object
readonly
Returns the value of attribute channel_name.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#response_url ⇒ Object
readonly
Returns the value of attribute response_url.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#team_domain ⇒ Object
readonly
Returns the value of attribute team_domain.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#ts ⇒ Object
readonly
Returns the value of attribute ts.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Instance Method Summary collapse
- #arguments ⇒ Object
- #command? ⇒ Boolean
- #human? ⇒ Boolean
-
#initialize(source, data) ⇒ InboundMessage
constructor
A new instance of InboundMessage.
Constructor Details
#initialize(source, data) ⇒ InboundMessage
Returns a new instance of InboundMessage.
11 12 13 14 |
# File 'lib/bot_mob/inbound_message.rb', line 11 def initialize(source, data) @data = data send("parse_#{source}".to_sym, data) end |
Instance Attribute Details
#bot_id ⇒ Object (readonly)
Returns the value of attribute bot_id.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def bot_id @bot_id end |
#channel_id ⇒ Object (readonly)
Returns the value of attribute channel_id.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def channel_id @channel_id end |
#channel_name ⇒ Object (readonly)
Returns the value of attribute channel_name.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def channel_name @channel_name end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def command @command end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def data @data end |
#response_url ⇒ Object (readonly)
Returns the value of attribute response_url.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def response_url @response_url end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def source @source end |
#team_domain ⇒ Object (readonly)
Returns the value of attribute team_domain.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def team_domain @team_domain end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def team_id @team_id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def text @text end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def token @token end |
#ts ⇒ Object (readonly)
Returns the value of attribute ts.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def ts @ts end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def user_id @user_id end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
7 8 9 |
# File 'lib/bot_mob/inbound_message.rb', line 7 def user_name @user_name end |
Instance Method Details
#arguments ⇒ Object
16 17 18 |
# File 'lib/bot_mob/inbound_message.rb', line 16 def arguments @arguments ||= text[%r{\/[\w'_-]+\s*[\w'_-]+\s*(.*)}, 1] end |
#command? ⇒ Boolean
20 21 22 |
# File 'lib/bot_mob/inbound_message.rb', line 20 def command? !command.nil? end |
#human? ⇒ Boolean
24 25 26 |
# File 'lib/bot_mob/inbound_message.rb', line 24 def human? bot_id.nil? end |