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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef0147c441c7d163618ff3273ff4110509acf5f4462589c74f3055bde0a8bc5b
4
- data.tar.gz: 0afaff93535de9e0e68e0f958296e90a5f118761ecf2256632cdf239def152da
3
+ metadata.gz: 500a2a7ea4fb23d0901e54e030ce2272a2938ca26cc25346cd8a24a0c6d8fc72
4
+ data.tar.gz: 18bae45d424a793ed7abcb591e7bbbc43f3ac1509bf4bf02751dc92821005d88
5
5
  SHA512:
6
- metadata.gz: 7de1e45fe98ae222c312cf6202c6f9b9437bee7363f751280666644b43abb14931d74df2a6b0af31d4e468de408c6598fe278837db4e43399148ffb645f4cc74
7
- data.tar.gz: 4462429444e6e8793718cd1beb291a9cab446dd0ee30d2e9ab2e17d58f0977f08d490681dadeebe3ec391012f6d89f21a34e69a9297e8f22447eda4a238d59a5
6
+ metadata.gz: 46de7ebf67ce468f1b361b672d36a4cf31a73342db741ce17c9bc6d67fc8cefb461d6edc51ca700cce9c87dd7e47e275134953e3bddfa285fd82d371610c0b5e
7
+ data.tar.gz: 773cb492a2dec48103df2269b0f45a14a6747e3c0d0b1788f691beea11d953446c2bff4f63f45c80b5e45a6bcbd9fbf3af8899edb9440a29a531da0320e77cbb
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ ### v0.6.2
2
+ - Fixed a regression where groups, DMs, and private channels were not fetched
3
+
4
+ ### v0.6.1
5
+ - Fixed a typo with creating a DM associated with a user
6
+
7
+ ### v0.6.0
8
+ - Switched to using the Slack Conversations API
@@ -176,16 +176,27 @@ module Slacks
176
176
  "is_im" => true,
177
177
  "name" => user.username }
178
178
  else
179
- Slacks::Channel.new(self, conversations_by_id.fetch(id) do
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
- Slacks::User.new(self, users_by_id.fetch(id) do
187
- raise ArgumentError, "Unable to find a user with the ID #{id.inspect}"
188
- end)
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"] ] }]
@@ -1,3 +1,3 @@
1
1
  module Slacks
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
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.1
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