mixin_bot 0.1.0 → 0.1.1
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/me.rb +10 -10
- data/lib/mixin_bot/api/user.rb +8 -7
- data/lib/mixin_bot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 844001cb92b3511f30cef15d4873763c9ff6f9d393d7ca8817afbad883ea4833
|
4
|
+
data.tar.gz: fb5e5e37129d3ccf01cb514fcf99c3539a9a73176d6c1d9ba5e3d35f48f55f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cc3caa449ef5bf0762c649e2be29b605b43e666d7ed651e7c01de6f590c88379b52510690fda86ceb411eaad62e2fc7a725c9eaea49d2a4979c5998eac63a02
|
7
|
+
data.tar.gz: 93cd21b8afd209f37e82f721eb99fa53abe30f435a78a701f34a9a9f259dff671e5544899e01cdded4ae5aef2682fd96ac1c1bd6027adcc5d6572b8cadba2d0b
|
data/lib/mixin_bot/api/me.rb
CHANGED
@@ -4,9 +4,9 @@ module MixinBot
|
|
4
4
|
class API
|
5
5
|
module Me
|
6
6
|
# https://developers.mixin.one/api/beta-mixin-message/read-profile/
|
7
|
-
def read_me
|
7
|
+
def read_me(access_token = nil)
|
8
8
|
path = '/me'
|
9
|
-
access_token
|
9
|
+
access_token ||= access_token('GET', path, '')
|
10
10
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
11
11
|
client.get(path, headers: { 'Authorization': authorization })
|
12
12
|
end
|
@@ -14,37 +14,37 @@ module MixinBot
|
|
14
14
|
# https://developers.mixin.one/api/beta-mixin-message/update-profile/
|
15
15
|
# avatar_base64:
|
16
16
|
# String: Base64 of image, supports format png, jpeg and gif, base64 image size > 1024.
|
17
|
-
def update_me(full_name:, avatar_base64: nil)
|
17
|
+
def update_me(full_name:, avatar_base64: nil, access_token: nil)
|
18
18
|
path = '/me'
|
19
19
|
payload = {
|
20
20
|
full_name: full_name,
|
21
21
|
avatar_base64: avatar_base64
|
22
22
|
}
|
23
|
-
access_token
|
23
|
+
access_token ||= access_token('POST', path, payload.to_json)
|
24
24
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
25
25
|
client.post(path, headers: { 'Authorization': authorization }, json: payload)
|
26
26
|
end
|
27
27
|
|
28
28
|
# https://developers.mixin.one/api/alpha-mixin-network/read-assets/
|
29
|
-
def read_assets
|
29
|
+
def read_assets(access_token = nil)
|
30
30
|
path = '/assets'
|
31
|
-
access_token
|
31
|
+
access_token ||= access_token('GET', path, '')
|
32
32
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
33
33
|
client.get(path, headers: { 'Authorization': authorization })
|
34
34
|
end
|
35
35
|
|
36
36
|
# https://developers.mixin.one/api/alpha-mixin-network/read-asset/
|
37
|
-
def read_asset(asset_id)
|
37
|
+
def read_asset(asset_id, access_token = nil)
|
38
38
|
path = format('/assets/%<asset_id>s', asset_id: asset_id)
|
39
|
-
access_token
|
39
|
+
access_token ||= access_token('GET', path, '')
|
40
40
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
41
41
|
client.get(path, headers: { 'Authorization': authorization })
|
42
42
|
end
|
43
43
|
|
44
44
|
# https://developers.mixin.one/api/beta-mixin-message/friends/
|
45
|
-
def read_friends
|
45
|
+
def read_friends(access_token = nil)
|
46
46
|
path = '/friends'
|
47
|
-
access_token
|
47
|
+
access_token ||= access_token('GET', path, '')
|
48
48
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
49
49
|
client.get(path, headers: { 'Authorization': authorization })
|
50
50
|
end
|
data/lib/mixin_bot/api/user.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
module MixinBot
|
4
4
|
class API
|
5
5
|
module User
|
6
|
-
|
7
|
-
|
6
|
+
# https://developers.mixin.one/api/beta-mixin-message/read-user/
|
7
|
+
def read_user(user_id)
|
8
|
+
# user_id: Mixin User UUID
|
8
9
|
path = format('/users/%<user_id>s', user_id: user_id)
|
9
|
-
access_token
|
10
|
+
access_token = access_token('GET', path, '')
|
10
11
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
11
12
|
client.get(path, headers: { 'Authorization': authorization })
|
12
13
|
end
|
@@ -40,22 +41,22 @@ module MixinBot
|
|
40
41
|
|
41
42
|
# https://developers.mixin.one/api/beta-mixin-message/search-user/
|
42
43
|
# search by Mixin Id or Phone Number
|
43
|
-
def search_user(query
|
44
|
+
def search_user(query)
|
44
45
|
path = format('/search/%<query>s', query: query)
|
45
46
|
|
46
|
-
access_token
|
47
|
+
access_token = access_token('GET', path, '')
|
47
48
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
48
49
|
client.get(path, headers: { 'Authorization': authorization })
|
49
50
|
end
|
50
51
|
|
51
52
|
# https://developers.mixin.one/api/beta-mixin-message/read-users/
|
52
|
-
def fetch_users(user_ids
|
53
|
+
def fetch_users(user_ids)
|
53
54
|
# user_ids: a array of user_ids
|
54
55
|
path = '/users/fetch'
|
55
56
|
user_ids = [user_ids] if user_ids.is_a? String
|
56
57
|
payload = user_ids
|
57
58
|
|
58
|
-
access_token
|
59
|
+
access_token = access_token('POST', path, payload.to_json)
|
59
60
|
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
60
61
|
client.post(path, headers: { 'Authorization': authorization }, json: payload)
|
61
62
|
end
|
data/lib/mixin_bot/version.rb
CHANGED