Class: SlackChatter::Api::Groups

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

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#bool_as_i, #call_method, #channel_id_or_name, #initialize

Constructor Details

This class inherits a constructor from SlackChatter::Api::Base

Instance Method Details

#archive(channel_id) ⇒ Object



6
7
8
9
# File 'lib/slack_chatter/api/groups.rb', line 6

def archive channel_id
  params = {"channel" => channel_id}
  call_method("groups", "archive", params)
end

#close(channel_id) ⇒ Object



11
12
13
14
# File 'lib/slack_chatter/api/groups.rb', line 11

def close channel_id
  params = {"channel" => channel_id}
  call_method("groups", "close", params)
end

#create(channel_name) ⇒ Object



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

def create channel_name
  # channel_name    - name of channel to recreate
  params = {"name" => channel_name}
  call_method("groups", "create", params)
end

#create_child(channel_id) ⇒ Object



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

def create_child channel_id
  call_method("groups", "createChild", {"channel" => channel_id})
end

#history(channel_id, opts = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/slack_chatter/api/groups.rb', line 26

def history channel_id, opts={}
  # latest          - End of time range of messages to include in results
  # oldest          - Start of time range of messages to include in results
  # inclusive       - Include messages with latest or oldest timestamp in results (send 0/1)
  # count           - Number of messages to return, between 1 and 1000
  call_method("groups", "history", {"channel" => channel_id}.merge(opts))
end

#info(channel_id) ⇒ Object



34
35
36
# File 'lib/slack_chatter/api/groups.rb', line 34

def info channel_id
  call_method("groups", "info", {"channel" => channel_id})
end

#invite(channel_id, user_id) ⇒ Object



38
39
40
# File 'lib/slack_chatter/api/groups.rb', line 38

def invite channel_id, user_id
  call_method("groups", "invite", {"channel" => channel_id, "user" => user_id})
end

#kick(channel_id, user_id) ⇒ Object



42
43
44
# File 'lib/slack_chatter/api/groups.rb', line 42

def kick channel_id, user_id
  call_method("groups", "kick", {"channel" => channel_id, "user" => user_id})
end

#leave(channel_id) ⇒ Object



46
47
48
# File 'lib/slack_chatter/api/groups.rb', line 46

def leave channel_id
  call_method("groups", "leave", {"channel" => channel_id})
end

#list(exclude_archived = false) ⇒ Object



50
51
52
53
# File 'lib/slack_chatter/api/groups.rb', line 50

def list exclude_archived=false
  # exclude_archives - Don't return archived groups (send 0/1)
  call_method("groups", "list", {"exclude_archived" => bool_as_i(exclude_archived)})
end

#mark(channel_id, epoch_time_stamp) ⇒ Object



55
56
57
58
# File 'lib/slack_chatter/api/groups.rb', line 55

def mark channel_id, epoch_time_stamp
  # ts               - Timestamp of the most recently seen message
  call_method("groups", "mark", {"channel" => channel_id, "ts" => epoch_time_stamp})
end

#open(channel_id) ⇒ Object



60
61
62
# File 'lib/slack_chatter/api/groups.rb', line 60

def open channel_id
  call_method("groups", "open", {"channel" => channel_id})
end

#rename(channel_id, new_name) ⇒ Object



64
65
66
67
# File 'lib/slack_chatter/api/groups.rb', line 64

def rename channel_id, new_name
  # new_name         - New name for channel
  call_method("groups", "rename", {"channel" => channel_id, "name" => new_name})
end

#set_purpose(channel_id, purpose) ⇒ Object



69
70
71
72
# File 'lib/slack_chatter/api/groups.rb', line 69

def set_purpose channel_id, purpose
  # purpose          - The new purpose for the channel
  call_method("groups", "setPurpose", {"channel" => channel_id, "purpose" => purpose})
end

#set_topic(channel_id, topic) ⇒ Object



74
75
76
77
# File 'lib/slack_chatter/api/groups.rb', line 74

def set_topic channel_id, topic
  # topic            - The new topic for the channel
  call_method("groups", "setTopic", {"channel" => channel_id, "topic" => topic})
end

#unarchive(channel_id) ⇒ Object



79
80
81
# File 'lib/slack_chatter/api/groups.rb', line 79

def unarchive channel_id
  call_method("groups", "unarchive", {"channel"=> channel_id})
end