Sha256: e57454d0914d5a29656e3cd7104a01076f78318f606bf19efceb4d7ac219340e
Contents?: true
Size: 867 Bytes
Versions: 3
Compression:
Stored size: 867 Bytes
Contents
module Slack module Web module Api module Mixins module Groups # # This method returns a group ID given a group name. # # @option options [channel] :channel # Group channel to get ID for, prefixed with #. def groups_id(options = {}) name = options[:channel] throw ArgumentError.new('Required arguments :channel missing') if name.nil? return { 'ok' => true, 'group' => { 'id' => name } } unless name[0] == '#' groups_list.tap do |list| list['groups'].each do |group| return { 'ok' => true, 'group' => { 'id' => group['id'] } } if group['name'] == name[1..-1] end end fail Slack::Web::Api::Error, 'channel_not_found' end end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems