Class: Slack::API::Channels
- Inherits:
-
Base
- Object
- Base
- Slack::API::Channels
show all
- Defined in:
- lib/laziness/api/channels.rb
Instance Attribute Summary
Attributes inherited from Base
#access_token
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#all(exclude_archived = false, page: nil) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/laziness/api/channels.rb', line 4
def all(exclude_archived=false, page: nil)
responses = with_paging(page) do ||
request :get,
'channels.list',
exclude_archived: exclude_archived ? 1 : 0,
**.to_h
end
Slack::Channel.parse_all responses, 'channels'
end
|
#archive(id) ⇒ Object
15
16
17
|
# File 'lib/laziness/api/channels.rb', line 15
def archive(id)
with_nil_response { request :post, 'channels.archive', channel: id }
end
|
#create(name) ⇒ Object
19
20
21
22
|
# File 'lib/laziness/api/channels.rb', line 19
def create(name)
response = request :post, 'channels.create', name: name
Slack::Channel.parse response, 'channel'
end
|
#find(id) ⇒ Object
24
25
26
27
|
# File 'lib/laziness/api/channels.rb', line 24
def find(id)
response = request :get, 'channels.info', channel: id
Slack::Channel.parse response, 'channel'
end
|
#unarchive(id) ⇒ Object
29
30
31
|
# File 'lib/laziness/api/channels.rb', line 29
def unarchive(id)
with_nil_response { request :post, 'channels.unarchive', channel: id }
end
|