mixin_bot 0.5.2 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mixin_bot/api/attachment.rb +19 -0
- data/lib/mixin_bot/api/message.rb +8 -0
- data/lib/mixin_bot/api/multisig.rb +12 -0
- data/lib/mixin_bot/client.rb +3 -0
- data/lib/mixin_bot/version.rb +1 -1
- data/lib/mixin_bot.rb +1 -0
- 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: f65a69b3d924aecec8bde921fcc600f117937c25ad656dc0779db1db512b2570
|
4
|
+
data.tar.gz: 8cae0fb36dd2244cd97892f9410fdda8d86c775451496105bfeac65bfac2cfc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2217346a169bbb546e2a63d4c9b3c3116eddcfb2563ad90d294dc945cc8d9e5617b20d20d0fc8a50b0d95981e9a9d06817afd6f4788ceb06ee7459808ef7de41
|
7
|
+
data.tar.gz: e566c88279c8337ccc1c03f92ea6a3c41e9cdc1a6f854c76ef64432d65c11cc78a2c3f3fcba32a5d2f70f952d56538b90150de917ddcd11c478091f427eb098a
|
@@ -21,6 +21,25 @@ module MixinBot
|
|
21
21
|
client.post(path, headers: { 'Authorization': authorization }, json: {})
|
22
22
|
end
|
23
23
|
|
24
|
+
def upload_attachment(file)
|
25
|
+
attachment = create_attachment['data']
|
26
|
+
|
27
|
+
HTTP
|
28
|
+
.timeout(connect: 5, write: 5, read: 5)
|
29
|
+
.request(
|
30
|
+
:put,
|
31
|
+
attachment.delete('upload_url'),
|
32
|
+
{
|
33
|
+
body: file,
|
34
|
+
headers: {
|
35
|
+
'x-amz-acl': 'public-read',
|
36
|
+
'Content-Type': 'application/octet-stream',
|
37
|
+
}
|
38
|
+
})
|
39
|
+
|
40
|
+
attachment
|
41
|
+
end
|
42
|
+
|
24
43
|
def read_attachment(attachment_id)
|
25
44
|
path = format('/attachments/%<id>s', id: attachment_id)
|
26
45
|
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
|
@@ -304,6 +304,18 @@ module MixinBot
|
|
304
304
|
|
305
305
|
res
|
306
306
|
end
|
307
|
+
|
308
|
+
def generate_trace_from_hash(hash, output_index = 0)
|
309
|
+
md5 = Digest::MD5.new
|
310
|
+
md5 << hash
|
311
|
+
md5 << [output_index].pack('c*') if output_index.positive? && output_index < 256
|
312
|
+
digest = md5.digest
|
313
|
+
digest[6] = ((digest[6].ord & 0x0f) | 0x30).chr
|
314
|
+
digest[8] = ((digest[8].ord & 0x3f) | 0x80).chr
|
315
|
+
hex = digest.unpack1('H*')
|
316
|
+
|
317
|
+
[hex[0..7], hex[8..11], hex[12..15], hex[16..19], hex[20..]].join('-')
|
318
|
+
end
|
307
319
|
end
|
308
320
|
end
|
309
321
|
end
|
data/lib/mixin_bot/client.rb
CHANGED
@@ -68,6 +68,7 @@ module MixinBot
|
|
68
68
|
# 500 30100 The current asset's public chain synchronization error.
|
69
69
|
# 500 30101 Wrong private key.
|
70
70
|
# 500 30102 Wrong withdrawal address.
|
71
|
+
# 500 30103 Insufficient pool.
|
71
72
|
# 500 7000 WebSocket server error.
|
72
73
|
# 500 7001 WebSocket operation timeout.
|
73
74
|
case result['error']['code']
|
@@ -81,6 +82,8 @@ module MixinBot
|
|
81
82
|
raise InsufficientBalanceError, errmsg
|
82
83
|
when 20118, 20119
|
83
84
|
raise PinError, errmsg
|
85
|
+
when 30103
|
86
|
+
raise InsufficientPoolError, errmsg
|
84
87
|
else
|
85
88
|
raise ResponseError, errmsg
|
86
89
|
end
|
data/lib/mixin_bot/version.rb
CHANGED
data/lib/mixin_bot.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.6
|
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-30 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
|