mos-eisley-lambda 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slack.rb +21 -15
- data/mos-eisley-lambda.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93e80b178ebf50a338825f24796cd4a940360ade9c5cb4e86febddc8c698892e
|
4
|
+
data.tar.gz: fd8899967cb3969f38f2b51e2c6e4482185a7b9b690b8201aa28279e008ae0b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31260b991c3adfd3b83a88b67f10c045a5ae6caab05a49bceff69e946230a953af0a55c8107e4ab7026bb8d4b10f7fd66c183164577c09369377fb78886ad1d7
|
7
|
+
data.tar.gz: 2b8a6b426911626cdc93827638f8057aebac906925307eaf1d3488dab00c73ec61c664e6f270bd2b34ee80e4ee6982b27dce22cd91f5e0278ed0c76e601bdf30
|
data/lib/slack.rb
CHANGED
@@ -120,33 +120,45 @@ module MosEisley
|
|
120
120
|
def self.views_push(trigger_id:, view:)
|
121
121
|
end
|
122
122
|
|
123
|
+
def self.conversations_members(channel:, cursor: nil, limit: nil)
|
124
|
+
params = {channel: channel}
|
125
|
+
params[:cursor] = cursor if cursor
|
126
|
+
params[:limit] = limit if limit
|
127
|
+
get_from_slack('conversations.members', params)
|
128
|
+
end
|
129
|
+
|
123
130
|
def self.users_info(user)
|
124
|
-
|
131
|
+
get_from_slack('users.info', {user: user})
|
125
132
|
end
|
126
133
|
|
127
134
|
def self.users_list(cursor: nil, limit: nil)
|
128
135
|
params = {include_locale: true}
|
129
136
|
params[:cursor] = cursor if cursor
|
130
137
|
params[:limit] = limit if limit
|
131
|
-
|
138
|
+
get_from_slack('users.list', params)
|
132
139
|
end
|
133
140
|
|
134
141
|
def self.users_lookupbyemail(email)
|
135
|
-
|
142
|
+
get_from_slack('users.lookupByEmail', {email: email})
|
136
143
|
end
|
137
144
|
|
138
145
|
def self.users_profile_get(user)
|
139
|
-
|
146
|
+
get_from_slack('users.profile.get', {user: user})
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.auth_test
|
150
|
+
post_to_slack('auth.test', '')
|
140
151
|
end
|
141
152
|
|
142
|
-
|
153
|
+
private
|
154
|
+
|
155
|
+
def self.get_from_slack(m, params)
|
143
156
|
l = MosEisley.logger
|
144
|
-
|
145
|
-
url ||= BASE_URL + call
|
157
|
+
url ||= BASE_URL + m
|
146
158
|
head = {authorization: "Bearer #{ENV['SLACK_BOT_ACCESS_TOKEN']}"}
|
147
159
|
r = Neko::HTTP.get(url, params, head)
|
148
160
|
if r[:code] != 200
|
149
|
-
l.warn("#{
|
161
|
+
l.warn("#{m} HTTP failed: #{r[:message]}")
|
150
162
|
return nil
|
151
163
|
end
|
152
164
|
begin
|
@@ -154,7 +166,7 @@ module MosEisley
|
|
154
166
|
if h[:ok]
|
155
167
|
return h
|
156
168
|
else
|
157
|
-
l.warn("#{
|
169
|
+
l.warn("#{m} Slack failed: #{h[:error]}")
|
158
170
|
l.debug("#{h[:response_metadata]}")
|
159
171
|
return nil
|
160
172
|
end
|
@@ -163,12 +175,6 @@ module MosEisley
|
|
163
175
|
end
|
164
176
|
end
|
165
177
|
|
166
|
-
def self.auth_test
|
167
|
-
post_to_slack('auth.test', '')
|
168
|
-
end
|
169
|
-
|
170
|
-
private
|
171
|
-
|
172
178
|
def self.post_to_slack(method, data, url = nil)
|
173
179
|
l = MosEisley.logger
|
174
180
|
url ||= BASE_URL + method
|
data/mos-eisley-lambda.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mos-eisley-lambda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken J.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby based Slack bot framework, for AWS Lambda use. Also provides helpers
|
14
14
|
to analyze/build messages. Event based utilizing SQS.
|