Class: SlackRubyBot::Client
- Inherits:
-
Slack::RealTime::Client
- Object
- Slack::RealTime::Client
- SlackRubyBot::Client
- Defined in:
- lib/slack-ruby-bot/client.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#auth ⇒ Object
Returns the value of attribute auth.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Client
constructor
A new instance of Client.
- #name ⇒ Object
- #name?(name) ⇒ Boolean
- #names ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Client
6 7 8 9 |
# File 'lib/slack-ruby-bot/client.rb', line 6 def initialize(attrs = {}) super(attrs) @aliases = attrs[:aliases] end |
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
4 5 6 |
# File 'lib/slack-ruby-bot/client.rb', line 4 def aliases @aliases end |
#auth ⇒ Object
Returns the value of attribute auth.
3 4 5 |
# File 'lib/slack-ruby-bot/client.rb', line 3 def auth @auth end |
Instance Method Details
#name ⇒ Object
30 31 32 |
# File 'lib/slack-ruby-bot/client.rb', line 30 def name SlackRubyBot.config.user || (auth && auth['user']) end |
#name?(name) ⇒ Boolean
26 27 28 |
# File 'lib/slack-ruby-bot/client.rb', line 26 def name?(name) name && names.include?(name.downcase) end |
#names ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/slack-ruby-bot/client.rb', line 11 def names [ SlackRubyBot::Config.user, auth ? auth['user'] : nil, aliases, SlackRubyBot::Config.aliases, auth ? "<@#{auth['user_id'].downcase}>" : nil, SlackRubyBot::Config.user_id ? "<@#{SlackRubyBot::Config.user_id.downcase}>" : nil, auth ? "<@#{auth['user_id'].downcase}>:" : nil, SlackRubyBot::Config.user_id ? "<@#{SlackRubyBot::Config.user_id.downcase}>:" : nil, auth ? "#{auth['user']}:" : nil, SlackRubyBot::Config.user ? "#{SlackRubyBot::Config.user}:" : nil ].compact.flatten end |
#url ⇒ Object
34 35 36 |
# File 'lib/slack-ruby-bot/client.rb', line 34 def url SlackRubyBot.config.url || (auth && auth['url']) end |