Class: BotMob::Slack::InboundMessage

Inherits:
InboundMessage show all
Defined in:
lib/bot_mob/slack/inbound_message.rb

Instance Attribute Summary collapse

Attributes inherited from InboundMessage

#network, #text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from InboundMessage

#arguments

Constructor Details

#initialize(params) ⇒ InboundMessage

Returns a new instance of InboundMessage.



8
9
10
11
12
13
# File 'lib/bot_mob/slack/inbound_message.rb', line 8

def initialize(params)
  @format = params[:format] || :websocket
  @network = params[:network]
  @params = params
  send("parse_#{format}".to_sym, @params)
end

Instance Attribute Details

#bot_idObject (readonly)

Returns the value of attribute bot_id.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def bot_id
  @bot_id
end

#channel_idObject (readonly)

Returns the value of attribute channel_id.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def channel_id
  @channel_id
end

#channel_nameObject (readonly)

Returns the value of attribute channel_name.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def channel_name
  @channel_name
end

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def command
  @command
end

#external_idObject (readonly)

Returns the value of attribute external_id.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def external_id
  @external_id
end

#formatObject (readonly)

Returns the value of attribute format.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def format
  @format
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def params
  @params
end

#response_urlObject (readonly)

Returns the value of attribute response_url.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def response_url
  @response_url
end

#team_domainObject (readonly)

Returns the value of attribute team_domain.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def team_domain
  @team_domain
end

#team_idObject (readonly)

Returns the value of attribute team_id.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def team_id
  @team_id
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def token
  @token
end

#tsObject (readonly)

Returns the value of attribute ts.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def ts
  @ts
end

#user_nameObject (readonly)

Returns the value of attribute user_name.



4
5
6
# File 'lib/bot_mob/slack/inbound_message.rb', line 4

def user_name
  @user_name
end

Class Method Details

.parse(params) ⇒ Object



15
16
17
# File 'lib/bot_mob/slack/inbound_message.rb', line 15

def self.parse(params)
  new(params)
end

Instance Method Details

#command?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/bot_mob/slack/inbound_message.rb', line 23

def command?
  !command.nil?
end

#human?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/bot_mob/slack/inbound_message.rb', line 19

def human?
  bot_id.nil?
end