Class: Slack::API::Groups

Inherits:
Base
  • Object
show all
Defined in:
lib/laziness/api/groups.rb

Instance Attribute Summary

Attributes inherited from Base

#access_token

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Slack::API::Base

Instance Method Details

#all(exclude_archived = false) ⇒ Object



4
5
6
7
# File 'lib/laziness/api/groups.rb', line 4

def all(exclude_archived=false)
  response = request :get, 'groups.list', exclude_archived: exclude_archived ? 1 : 0
  Slack::Group.parse response, 'groups'
end

#archive(id) ⇒ Object



9
10
11
# File 'lib/laziness/api/groups.rb', line 9

def archive(id)
  with_nil_response { request :post, 'groups.archive', channel: id }
end

#close(id) ⇒ Object



13
14
15
# File 'lib/laziness/api/groups.rb', line 13

def close(id)
  with_nil_response { request :post, 'groups.close', channel: id }
end

#copy(id) ⇒ Object



17
18
19
20
# File 'lib/laziness/api/groups.rb', line 17

def copy(id)
  response = request :post, 'groups.createChild', channel: id
  Slack::Group.parse response, 'group'
end

#create(name) ⇒ Object



22
23
24
25
# File 'lib/laziness/api/groups.rb', line 22

def create(name)
  response = request :post, 'groups.create', name: name
  Slack::Group.parse response, 'group'
end

#find(id) ⇒ Object



27
28
29
30
# File 'lib/laziness/api/groups.rb', line 27

def find(id)
  response = request :get, 'groups.info', channel: id
  Slack::Group.parse response, 'group'
end

#invite(id, user_id) ⇒ Object



32
33
34
35
# File 'lib/laziness/api/groups.rb', line 32

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) ⇒ Object



37
38
39
# File 'lib/laziness/api/groups.rb', line 37

def kick(id, user_id)
  with_nil_response { request :post, 'groups.kick', channel: id, user: user_id }
end

#leave(id) ⇒ Object



41
42
43
# File 'lib/laziness/api/groups.rb', line 41

def leave(id)
  with_nil_response { request :post, 'groups.leave', channel: id }
end

#open(id) ⇒ Object



45
46
47
# File 'lib/laziness/api/groups.rb', line 45

def open(id)
  with_nil_response { request :post, 'groups.open', channel: id }
end

#unarchive(id) ⇒ Object



49
50
51
# File 'lib/laziness/api/groups.rb', line 49

def unarchive(id)
  with_nil_response { request :post, 'groups.unarchive', channel: id }
end

#update_purpose(id, purpose) ⇒ Object



53
54
55
# File 'lib/laziness/api/groups.rb', line 53

def update_purpose(id, purpose)
  with_nil_response { request :post, 'groups.setPurpose', channel: id, purpose: purpose }
end

#update_topic(id, topic) ⇒ Object



57
58
59
# File 'lib/laziness/api/groups.rb', line 57

def update_topic(id, topic)
  with_nil_response { request :post, 'groups.setTopic', channel: id, topic: topic }
end