Class: SlackbotFrd::SlackMethods::ChannelsInfo
- Inherits:
-
Object
- Object
- SlackbotFrd::SlackMethods::ChannelsInfo
- Includes:
- HTTParty
- Defined in:
- lib/slackbot_frd/slack_methods/channels_info.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(token:, channel:) ⇒ ChannelsInfo
constructor
A new instance of ChannelsInfo.
- #members ⇒ Object (also: #users)
Constructor Details
#initialize(token:, channel:) ⇒ ChannelsInfo
Returns a new instance of ChannelsInfo.
16 17 18 19 |
# File 'lib/slackbot_frd/slack_methods/channels_info.rb', line 16 def initialize(token:, channel:) @token = token @channel = channel end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/slackbot_frd/slack_methods/channels_info.rb', line 10 def response @response end |
Class Method Details
.members(token:, channel:) ⇒ Object
12 13 14 |
# File 'lib/slackbot_frd/slack_methods/channels_info.rb', line 12 def self.members(token:, channel:) ChannelsInfo.new(token: token, channel: channel).connect.members end |
Instance Method Details
#connect ⇒ Object
21 22 23 24 25 |
# File 'lib/slackbot_frd/slack_methods/channels_info.rb', line 21 def connect @response = JSON.parse(self.class.post('', :body => { token: @token, channel: @channel } ).body) ValidateSlack.response(@response) self end |
#members ⇒ Object Also known as: users
27 28 29 30 31 32 33 |
# File 'lib/slackbot_frd/slack_methods/channels_info.rb', line 27 def members if @response['channel'] @response['channel']['members'] else [] end end |