Class: Slackup::Groups
Constant Summary
Constants inherited from Slackup
Error, RUN_ROOT, SEMAPHORE, VERSION
Instance Attribute Summary
Attributes inherited from Slackup
Instance Method Summary collapse
- #groups_dir ⇒ Object
-
#list ⇒ Object
(also: #groups)
{ “ok”: true, “groups”: [ { “id”: “G0ABC”, “name”: “some-group”, “is_group”: true, “created”: 1436923155, “creator”: “UABC”, “is_archived”: false, “members”: [ ], “topic”: { “value”: “”, “creator”: “”, “last_set”: 0 }, “purpose”: { “value”: “Some group”, “creator”: “UABC”, “last_set”: 1437105751 } } ] }.
- #messages(group) ⇒ Object
- #write! ⇒ Object
- #write_messages(group) ⇒ Object
Methods inherited from Slackup
backup, configure_client, #execute, #initialize, run_root, team_token_pairs, team_token_pairs_file
Constructor Details
This class inherits a constructor from Slackup
Instance Method Details
#groups_dir ⇒ Object
55 56 57 58 59 |
# File 'lib/slackup/groups.rb', line 55 def groups_dir @groups_dir ||= "groups" FileUtils.mkdir_p(@groups_dir) @groups_dir end |
#list ⇒ Object Also known as: groups
{
"ok": true,
"groups": [
{
"id": "G0ABC",
"name": "some-group",
"is_group": true,
"created": 1436923155,
"creator": "UABC",
"is_archived": false,
"members": [
],
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "Some group",
"creator": "UABC",
"last_set": 1437105751
}
}
]
}
28 29 30 |
# File 'lib/slackup/groups.rb', line 28 def list @list ||= client.groups_list["groups"] end |
#messages(group) ⇒ Object
41 42 43 |
# File 'lib/slackup/groups.rb', line 41 def (group) client.groups_history(channel: group["id"], count: "1000") end |
#write! ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/slackup/groups.rb', line 33 def write! Dir.chdir(groups_dir) do groups.each do |group| (group) end end end |
#write_messages(group) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/slackup/groups.rb', line 46 def (group) group, (group) do || File.open(backup_filename(group["name"]), "w") do |f| = () f.write serialize() end end end |