slacks 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/slacks/connection.rb +17 -6
- data/lib/slacks/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 500a2a7ea4fb23d0901e54e030ce2272a2938ca26cc25346cd8a24a0c6d8fc72
|
4
|
+
data.tar.gz: 18bae45d424a793ed7abcb591e7bbbc43f3ac1509bf4bf02751dc92821005d88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46de7ebf67ce468f1b361b672d36a4cf31a73342db741ce17c9bc6d67fc8cefb461d6edc51ca700cce9c87dd7e47e275134953e3bddfa285fd82d371610c0b5e
|
7
|
+
data.tar.gz: 773cb492a2dec48103df2269b0f45a14a6747e3c0d0b1788f691beea11d953446c2bff4f63f45c80b5e45a6bcbd9fbf3af8899edb9440a29a531da0320e77cbb
|
data/CHANGELOG.md
ADDED
data/lib/slacks/connection.rb
CHANGED
@@ -176,16 +176,27 @@ module Slacks
|
|
176
176
|
"is_im" => true,
|
177
177
|
"name" => user.username }
|
178
178
|
else
|
179
|
-
Slacks::Channel.new(self,
|
179
|
+
Slacks::Channel.new(self, find_conversation(id))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def find_conversation(id)
|
184
|
+
conversations_by_id.fetch(id) do
|
185
|
+
fetch_conversations!
|
186
|
+
conversations_by_id.fetch(id) do
|
180
187
|
raise ArgumentError, "Unable to find a conversation with the ID #{id.inspect}"
|
181
|
-
end
|
188
|
+
end
|
182
189
|
end
|
183
190
|
end
|
184
191
|
|
185
192
|
def find_user(id)
|
186
|
-
|
187
|
-
|
188
|
-
|
193
|
+
user = users_by_id.fetch(id) do
|
194
|
+
fetch_users!
|
195
|
+
users_by_id.fetch(id) do
|
196
|
+
raise ArgumentError, "Unable to find a user with the ID #{id.inspect}"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
Slacks::User.new(self, user)
|
189
200
|
end
|
190
201
|
|
191
202
|
def find_user_by_nickname(nickname)
|
@@ -256,7 +267,7 @@ module Slacks
|
|
256
267
|
|
257
268
|
|
258
269
|
def fetch_conversations!
|
259
|
-
conversations, ims = api("conversations.list")["channels"].partition { |attrs| attrs["is_channel"] || attrs["is_group"] }
|
270
|
+
conversations, ims = api("conversations.list", types: "public_channel,private_channel,mpim,im")["channels"].partition { |attrs| attrs["is_channel"] || attrs["is_group"] }
|
260
271
|
user_ids_dm_ids.merge! Hash[ims.map { |attrs| attrs.values_at("user", "id") }]
|
261
272
|
@conversations_by_id = Hash[conversations.map { |attrs| [ attrs.fetch("id"), attrs ] }]
|
262
273
|
@conversation_ids_by_name = Hash[conversations.map { |attrs| [ attrs["name"], attrs["id"] ] }]
|
data/lib/slacks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
@@ -173,6 +173,7 @@ extra_rdoc_files: []
|
|
173
173
|
files:
|
174
174
|
- ".gitignore"
|
175
175
|
- ".travis.yml"
|
176
|
+
- CHANGELOG.md
|
176
177
|
- Gemfile
|
177
178
|
- LICENSE.txt
|
178
179
|
- README.md
|