Class: Lita::Adapters::Slack::SlackChannel
- Inherits:
-
Object
- Object
- Lita::Adapters::Slack::SlackChannel
- Defined in:
- lib/lita/adapters/slack/slack_channel.rb
Overview
A struct representing a Slack channel, group, or IM.
Instance Attribute Summary collapse
-
#created ⇒ String
readonly
A timestamp indicating when the channel was created.
-
#creator ⇒ String
readonly
The unique ID of the user who created the channel.
-
#id ⇒ String
readonly
The channel’s unique ID.
-
#name ⇒ String
readonly
The human-readable name for the channel.
-
#raw_data ⇒ Hash
readonly
The raw channel data received from Slack, including many more fields.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, name, created, creator, raw_data) ⇒ SlackChannel
constructor
A new instance of SlackChannel.
Constructor Details
#initialize(id, name, created, creator, raw_data) ⇒ SlackChannel
Returns a new instance of SlackChannel.
36 37 38 39 40 41 42 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 36 def initialize(id, name, created, creator, raw_data) @id = id @name = name @created = created @creator = creator @raw_data = raw_data end |
Instance Attribute Details
#created ⇒ String (readonly)
Returns A timestamp indicating when the channel was created.
30 31 32 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 30 def created @created end |
#creator ⇒ String (readonly)
Returns The unique ID of the user who created the channel.
32 33 34 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 32 def creator @creator end |
#id ⇒ String (readonly)
Returns The channel’s unique ID.
26 27 28 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 26 def id @id end |
#name ⇒ String (readonly)
Returns The human-readable name for the channel.
28 29 30 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 28 def name @name end |
#raw_data ⇒ Hash (readonly)
Returns The raw channel data received from Slack, including many more fields.
34 35 36 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 34 def raw_data @raw_data end |
Class Method Details
.from_data(channel_data) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 17 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 9 def from_data(channel_data) new( channel_data['id'], channel_data['name'], channel_data['created'], channel_data['creator'], channel_data ) end |
.from_data_array(channels_data) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/lita/adapters/slack/slack_channel.rb', line 20 def from_data_array(channels_data) channels_data.map { |channel_data| from_data(channel_data) } end |