mixin_bot 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mixin_bot/api/attachment.rb +21 -0
- data/lib/mixin_bot/api/message.rb +8 -0
- data/lib/mixin_bot/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1439e4f59c5ca53c83c1a897050bcb9ae236b930607d6c1dde62d558ce613ee3
|
4
|
+
data.tar.gz: 96a586f0bf29d839e997dd1a0eca16ab47055d2e6cf696d9d692fcf37052db74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e15f7d07d619ab3221172b369cd77b159719de186a18fddfd8f91689f9d8c6b86c6ac23c7ecc8cb08a46f1555108d4a48abbd10138e915f842f812a554d7b737
|
7
|
+
data.tar.gz: 043f8dab94962e4b9bcbf507867b803bc8afac226de9c6edd1b19ee1fa9daa729205e949f9d7b1213985bc117450af7234bfc11f14eaaec1ff53d322e979eed0
|
@@ -21,6 +21,27 @@ module MixinBot
|
|
21
21
|
client.post(path, headers: { 'Authorization': authorization }, json: {})
|
22
22
|
end
|
23
23
|
|
24
|
+
def upload_attachment(file)
|
25
|
+
raise 'not a File' unless file.is_a?(File)
|
26
|
+
|
27
|
+
attachment = create_attachment['data']
|
28
|
+
|
29
|
+
HTTP
|
30
|
+
.timeout(connect: 5, write: 5, read: 5)
|
31
|
+
.request(
|
32
|
+
:put,
|
33
|
+
attachment.delete('upload_url'),
|
34
|
+
{
|
35
|
+
body: file,
|
36
|
+
headers: {
|
37
|
+
'x-amz-acl': 'public-read',
|
38
|
+
'Content-Type': 'application/octet-stream',
|
39
|
+
}
|
40
|
+
})
|
41
|
+
|
42
|
+
attachment
|
43
|
+
end
|
44
|
+
|
24
45
|
def read_attachment(attachment_id)
|
25
46
|
path = format('/attachments/%<id>s', id: attachment_id)
|
26
47
|
access_token ||= access_token('GET', path, '')
|
@@ -276,6 +276,14 @@ module MixinBot
|
|
276
276
|
send_message plain_text(options)
|
277
277
|
end
|
278
278
|
|
279
|
+
def send_image_message(options)
|
280
|
+
send_message plain_image(options)
|
281
|
+
end
|
282
|
+
|
283
|
+
def send_file_message(options)
|
284
|
+
send_message plain_data(options)
|
285
|
+
end
|
286
|
+
|
279
287
|
def send_post_message(options)
|
280
288
|
send_message plain_post(options)
|
281
289
|
end
|
data/lib/mixin_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixin_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: fastimage
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.2.5
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.2.5
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: pry
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|