class Slack::API::Groups

Public Instance Methods

all(exclude_archived=false, page: nil) click to toggle source
# File lib/laziness/api/groups.rb, line 4
def all(exclude_archived=false, page: nil)
  responses = with_paging(page) do |pager|
    request :get,
            'groups.list',
            exclude_archived: exclude_archived ? 1 : 0,
            **pager.to_h
  end

  Slack::Group.parse_all responses, 'groups'
end
archive(id) click to toggle source
# File lib/laziness/api/groups.rb, line 15
def archive(id)
  with_nil_response { request :post, 'groups.archive', channel: id }
end
close(id) click to toggle source
# File lib/laziness/api/groups.rb, line 19
def close(id)
  with_nil_response { request :post, 'groups.close', channel: id }
end
copy(id) click to toggle source
# File lib/laziness/api/groups.rb, line 23
def copy(id)
  response = request :post, 'groups.createChild', channel: id
  Slack::Group.parse response, 'group'
end
create(name) click to toggle source
# File lib/laziness/api/groups.rb, line 28
def create(name)
  response = request :post, 'groups.create', name: name
  Slack::Group.parse response, 'group'
end
find(id) click to toggle source
# File lib/laziness/api/groups.rb, line 33
def find(id)
  response = request :get, 'groups.info', channel: id
  Slack::Group.parse response, 'group'
end
invite(id, user_id) click to toggle source
# File lib/laziness/api/groups.rb, line 38
def invite(id, user_id)
  response = request :post, 'groups.invite', channel: id, user: user_id
  Slack::Group.parse response, 'group'
end
kick(id, user_id) click to toggle source
# File lib/laziness/api/groups.rb, line 43
def kick(id, user_id)
  with_nil_response { request :post, 'groups.kick', channel: id, user: user_id }
end
leave(id) click to toggle source
# File lib/laziness/api/groups.rb, line 47
def leave(id)
  with_nil_response { request :post, 'groups.leave', channel: id }
end
open(id) click to toggle source
# File lib/laziness/api/groups.rb, line 51
def open(id)
  with_nil_response { request :post, 'groups.open', channel: id }
end
unarchive(id) click to toggle source
# File lib/laziness/api/groups.rb, line 55
def unarchive(id)
  with_nil_response { request :post, 'groups.unarchive', channel: id }
end
update_purpose(id, purpose) click to toggle source
# File lib/laziness/api/groups.rb, line 59
def update_purpose(id, purpose)
  with_nil_response { request :post, 'groups.setPurpose', channel: id, purpose: purpose }
end
update_topic(id, topic) click to toggle source
# File lib/laziness/api/groups.rb, line 63
def update_topic(id, topic)
  with_nil_response { request :post, 'groups.setTopic', channel: id, topic: topic }
end