easemob 0.0.1 → 0.2.0
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
- checksums.yaml.gz.sig +0 -0
- data/.codeclimate.yml +16 -0
- data/.gitignore +2 -0
- data/.travis.yml +3 -2
- data/README.md +17 -2
- data/lib/easemob/chatlog.rb +12 -0
- data/lib/easemob/chatrooms.rb +49 -0
- data/lib/easemob/fileoperation.rb +13 -0
- data/lib/easemob/groups.rb +71 -0
- data/lib/easemob/messages.rb +54 -0
- data/lib/easemob/users.rb +90 -2
- data/lib/easemob/version.rb +1 -1
- data/lib/easemob.rb +69 -22
- data.tar.gz.sig +0 -0
- metadata +33 -5
- metadata.gz.sig +3 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56ed81345e9a563df461fd8429d9d00cb3458a79
|
4
|
+
data.tar.gz: 8e1e91fd5bd5f05f98d4e8ac1f06fa87b8a84884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb273fa328e8ec22595d7c5399830187fcc4ba814b9c0b0437509c253cb4b7c03a95eade2fbc33f45c6a6d6263284dc1db084ae8d1b8a3ef068f95b6618ac5ca
|
7
|
+
data.tar.gz: 2e6d665da1c25459436c770edb202a63c9862c27c7353f893410d1e2c7adc880211d206a8a1cc9ceb829671e6d282ea1b0577f7f9fdeb6d6a5658ee82a8f0c97
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/.codeclimate.yml
ADDED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
|
1
|
+

|
2
2
|
|
3
|
-
|
3
|
+
easemob [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] [![Code Climate][codeclimate-badge]][codeclimate] [![Code Coverage][codecoverage-badge]][codecoverage]
|
4
|
+
=======
|
5
|
+
|
6
|
+
An unofficial [Easemob IM instant message service](http://www.easemob.com/product/im) integration gem, inspired from [huanxin](https://github.com/RobotJiang/ruby-for-huanxin) a lot.
|
7
|
+
|
8
|
+
`easemob` gem provide [ALL the RESTful API in server side integration](http://docs.easemob.com/im/100serverintegration/10intro).
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -46,3 +51,13 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/bayete
|
|
46
51
|
|
47
52
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
48
53
|
|
54
|
+
|
55
|
+
|
56
|
+
[version-badge]: https://badge.fury.io/rb/easemob.svg
|
57
|
+
[rubygems]: https://rubygems.org/gems/easemob
|
58
|
+
[travis-badge]: https://travis-ci.org/bayetech/easemob.svg
|
59
|
+
[travis]: https://travis-ci.org/bayetech/easemob
|
60
|
+
[codeclimate-badge]: https://codeclimate.com/github/bayetech/easemob/badges/gpa.svg
|
61
|
+
[codeclimate]: https://codeclimate.com/github/bayetech/easemob
|
62
|
+
[codecoverage-badge]: https://codeclimate.com/github/bayetech/easemob/badges/coverage.svg
|
63
|
+
[codecoverage]: https://codeclimate.com/github/bayetech/easemob/coverage
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Easemob
|
2
|
+
module Chatlog
|
3
|
+
def chatmessages(after: nil, before: nil, limit: 10, cursor: nil)
|
4
|
+
raise ArgumentError, 'Either give after or before, not both when call chatmessages' if after && before
|
5
|
+
params = { limit: limit }
|
6
|
+
params[:cursor] = cursor unless cursor.nil?
|
7
|
+
params[:ql] = "select * where timestamp>#{after.to_i}" unless after.nil?
|
8
|
+
params[:ql] = "select * where timestamp<#{before.to_i}" unless before.nil?
|
9
|
+
request :get, 'chatmessages', params: params
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Easemob
|
2
|
+
module Chatrooms
|
3
|
+
def create_chatroom(chatroom_name, description, owner, maxusers: 200, members: nil)
|
4
|
+
jd = { name: chatroom_name, description: description, owner: owner, maxusers: maxusers }
|
5
|
+
jd[:members] = members unless members.nil?
|
6
|
+
request :post, 'chatrooms', json: jd
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_chatroom(chatroom_id)
|
10
|
+
request :get, "chatrooms/#{chatroom_id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def query_chatrooms
|
14
|
+
request :get, 'chatrooms'
|
15
|
+
end
|
16
|
+
|
17
|
+
def user_joined_chatrooms(username)
|
18
|
+
request :get, "users/#{username}/joined_chatrooms"
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete_chatroom(chatroom_id)
|
22
|
+
request :delete, "chatrooms/#{chatroom_id}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def modify_chatroom(chatroom_id, chatroom_name: nil, description: nil, maxusers: nil)
|
26
|
+
jd = {}
|
27
|
+
jd[:name] = chatroom_name unless chatroom_name.nil?
|
28
|
+
jd[:description] = description unless description.nil?
|
29
|
+
jd[:maxusers] = maxusers unless maxusers.nil?
|
30
|
+
request :put, "chatrooms/#{chatroom_id}", json: jd
|
31
|
+
end
|
32
|
+
|
33
|
+
def user_join_chatroom(chatroom_id, username:)
|
34
|
+
request :post, "chatrooms/#{chatroom_id}/users/#{username}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def user_leave_chatroom(chatroom_id, username:)
|
38
|
+
request :delete, "chatrooms/#{chatroom_id}/users/#{username}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def chatroom_add_users(chatroom_id, usernames:)
|
42
|
+
request :post, "chatrooms/#{chatroom_id}/users", json: { usernames: [*usernames] }
|
43
|
+
end
|
44
|
+
|
45
|
+
def chatroom_remove_users(chatroom_id, usernames:)
|
46
|
+
request :delete, "chatrooms/#{chatroom_id}/users/#{[*usernames].join(',')}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Easemob
|
2
|
+
module Fileoperation
|
3
|
+
def upload_chatfile(file_path, restrict_access: true)
|
4
|
+
request :upload, 'chatfiles', form: { file: HTTP::FormData::File.new(file_path),
|
5
|
+
hack: 'X' }, # Existing here for http-form_data 1.0.1 handle single param improperly, see https://github.com/httprb/form_data.rb/issues/4
|
6
|
+
restrict_access: restrict_access
|
7
|
+
end
|
8
|
+
|
9
|
+
def download_chatfile(chatfile_uuid, share_secret: nil, thumbnail: false)
|
10
|
+
request :download, "chatfiles/#{chatfile_uuid}", share_secret: share_secret, thumbnail: thumbnail
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Easemob
|
2
|
+
module Groups
|
3
|
+
def create_group(groupname, description, owner, members: nil, is_public: true, maxusers: 200, is_approval: false)
|
4
|
+
jd = { groupname: groupname, desc: description, public: is_public, owner: owner, users: maxusers, approval: is_approval }
|
5
|
+
jd[:members] = members unless members.nil?
|
6
|
+
request :post, 'chatgroups', json: jd
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_groups(group_ids)
|
10
|
+
request :get, "chatgroups/#{[*group_ids].join(',')}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def query_groups(limit = 50, cursor: nil)
|
14
|
+
params = { limit: limit }
|
15
|
+
params[:cursor] = cursor unless cursor.nil?
|
16
|
+
request :get, 'chatgroups', params: params
|
17
|
+
end
|
18
|
+
|
19
|
+
def query_group_users(group_id)
|
20
|
+
request :get, "chatgroups/#{group_id}/users"
|
21
|
+
end
|
22
|
+
|
23
|
+
def query_group_blocks(group_id)
|
24
|
+
request :get, "chatgroups/#{group_id}/blocks/users"
|
25
|
+
end
|
26
|
+
|
27
|
+
def user_joined_chatgroups(username)
|
28
|
+
request :get, "users/#{username}/joined_chatgroups"
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_group(group_id)
|
32
|
+
request :delete, "chatgroups/#{group_id}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def modify_group(group_id, groupname: nil, description: nil, maxusers: nil)
|
36
|
+
jd = {}
|
37
|
+
jd[:groupname] = groupname unless groupname.nil?
|
38
|
+
jd[:description] = description unless description.nil?
|
39
|
+
jd[:maxusers] = maxusers unless maxusers.nil?
|
40
|
+
request :put, "chatgroups/#{group_id}", json: jd
|
41
|
+
end
|
42
|
+
|
43
|
+
def user_join_group(group_id, username:)
|
44
|
+
request :post, "chatgroups/#{group_id}/users/#{username}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def user_leave_group(group_id, username:)
|
48
|
+
request :delete, "chatgroups/#{group_id}/users/#{username}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def group_add_users(group_id, usernames:)
|
52
|
+
request :post, "chatgroups/#{group_id}/users", json: { usernames: [*usernames] }
|
53
|
+
end
|
54
|
+
|
55
|
+
def group_remove_users(group_id, usernames:)
|
56
|
+
request :delete, "chatgroups/#{group_id}/users/#{[*usernames].join(',')}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def group_set_owner(group_id, newowner:)
|
60
|
+
request :put, "chatgroups/#{group_id}", json: { newowner: newowner }
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_to_group_block(group_id, to_block_usernames:)
|
64
|
+
request :post, "chatgroups/#{group_id}/blocks/users", json: { usernames: [*to_block_usernames] }
|
65
|
+
end
|
66
|
+
|
67
|
+
def remove_from_group_block(group_id, blocked_usernames:)
|
68
|
+
request :delete, "chatgroups/#{group_id}/blocks/users/#{[*blocked_usernames].join(',')}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Easemob
|
2
|
+
module Messages
|
3
|
+
def message_to(target, target_type: :users, text:,
|
4
|
+
from: nil, ext: nil)
|
5
|
+
jd = { target_type: target_type, target: [*target],
|
6
|
+
msg: { type: :txt, txt: text } }
|
7
|
+
jd[:from] = from unless from.nil?
|
8
|
+
jd[:ext] = ext unless ext.nil?
|
9
|
+
request :post, 'messages', json: jd
|
10
|
+
end
|
11
|
+
|
12
|
+
def image_to(target, target_type: :users, url:, filename:,
|
13
|
+
secret: nil, from: nil, image_size: nil, ext: nil)
|
14
|
+
jd = { target_type: target_type, target: [*target],
|
15
|
+
msg: { type: :img, filename: filename, url: url } }
|
16
|
+
jd[:msg][:secret] = secret unless secret.nil?
|
17
|
+
jd[:from] = from unless from.nil?
|
18
|
+
jd[:size] = image_size unless image_size.nil?
|
19
|
+
jd[:ext] = ext unless ext.nil?
|
20
|
+
request :post, 'messages', json: jd
|
21
|
+
end
|
22
|
+
|
23
|
+
def audio_to(target, target_type: :users, url:, filename:, length:,
|
24
|
+
secret: nil, from: nil, ext: nil)
|
25
|
+
jd = { target_type: target_type, target: [*target],
|
26
|
+
msg: { type: :audio, url: url, filename: filename, length: length } }
|
27
|
+
jd[:msg][:secret] = secret unless secret.nil?
|
28
|
+
jd[:from] = from unless from.nil?
|
29
|
+
jd[:ext] = ext unless ext.nil?
|
30
|
+
request :post, 'messages', json: jd
|
31
|
+
end
|
32
|
+
|
33
|
+
def video_to(target, target_type: :users, url:, filename:, length:, file_length:, thumb:,
|
34
|
+
secret: nil, thumb_secret: nil, from: nil, ext: nil)
|
35
|
+
jd = { target_type: target_type, target: [*target],
|
36
|
+
msg: { type: :video, filename: filename, thumb: thumb, length: length,
|
37
|
+
file_length: file_length, url: url } }
|
38
|
+
jd[:msg][:secret] = secret unless secret.nil?
|
39
|
+
jd[:msg][:thumb_secret] = thumb_secret unless thumb_secret.nil?
|
40
|
+
jd[:from] = from unless from.nil?
|
41
|
+
jd[:ext] = ext unless ext.nil?
|
42
|
+
request :post, 'messages', json: jd
|
43
|
+
end
|
44
|
+
|
45
|
+
def command_to(target, target_type: :users, action:,
|
46
|
+
from: nil, ext: nil)
|
47
|
+
jd = { target_type: target_type, target: [*target],
|
48
|
+
msg: { type: :cmd, action: action } }
|
49
|
+
jd[:from] = from unless from.nil?
|
50
|
+
jd[:ext] = ext unless ext.nil?
|
51
|
+
request :post, 'messages', json: jd
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/easemob/users.rb
CHANGED
@@ -1,7 +1,95 @@
|
|
1
1
|
module Easemob
|
2
2
|
module Users
|
3
|
-
def create_user(username, password, nickname
|
4
|
-
|
3
|
+
def create_user(username, password, nickname: nil)
|
4
|
+
valid_username!(username)
|
5
|
+
jd = { username: username, password: password }
|
6
|
+
jd[:nickname] = nickname unless nickname.nil?
|
7
|
+
request :post, 'users', json: jd
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_users(users)
|
11
|
+
users.map { |user| valid_username!(user['username'] || user[:username]) }
|
12
|
+
request :post, 'users', json: users
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_user(username)
|
16
|
+
request :get, "users/#{username}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def query_users(limit = 50, cursor: nil)
|
20
|
+
params = { limit: limit }
|
21
|
+
params[:cursor] = cursor unless cursor.nil?
|
22
|
+
request :get, 'users', params: params
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete_user(username)
|
26
|
+
request :delete, "users/#{username}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete_users!(number = 100)
|
30
|
+
request :delete, 'users', params: { limit: number }
|
31
|
+
end
|
32
|
+
|
33
|
+
def reset_user_password(username, newpassword:)
|
34
|
+
request :put, "users/#{username}/password", json: { newpassword: newpassword }
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_user_nickname(username, nickname:)
|
38
|
+
request :put, "users/#{username}", json: { nickname: nickname }
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_user_friend(owner_username, friend_username:)
|
42
|
+
request :post, "users/#{owner_username}/contacts/users/#{friend_username}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_user_friend(owner_username, friend_username:)
|
46
|
+
request :delete, "users/#{owner_username}/contacts/users/#{friend_username}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def query_user_friends(owner_username)
|
50
|
+
request :get, "users/#{owner_username}/contacts/users"
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_to_user_block(owner_username, to_block_usernames:)
|
54
|
+
request :post, "users/#{owner_username}/blocks/users", json: { usernames: [*to_block_usernames] }
|
55
|
+
end
|
56
|
+
|
57
|
+
def remove_from_user_block(owner_username, blocked_username:)
|
58
|
+
request :delete, "users/#{owner_username}/blocks/users/#{blocked_username}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def query_user_blocks(owner_username)
|
62
|
+
request :get, "users/#{owner_username}/blocks/users"
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_user_status(username)
|
66
|
+
request :get, "users/#{username}/status"
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_user_offline_msg_count(owner_username)
|
70
|
+
request :get, "users/#{owner_username}/offline_msg_count"
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_user_offline_msg_status(username, msg_id)
|
74
|
+
request :get, "users/#{username}/offline_msg_status/#{msg_id}"
|
75
|
+
end
|
76
|
+
|
77
|
+
def deactivate_user(username)
|
78
|
+
request :post, "users/#{username}/deactivate"
|
79
|
+
end
|
80
|
+
|
81
|
+
def activate_user(username)
|
82
|
+
request :post, "users/#{username}/activate"
|
83
|
+
end
|
84
|
+
|
85
|
+
def disconnect_user(username)
|
86
|
+
request :get, "users/#{username}/disconnect"
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def valid_username!(username)
|
92
|
+
raise UserNameError, "#{username} is invalid for easemob" unless username[/[a-zA-Z0-9_-]*/] == username
|
5
93
|
end
|
6
94
|
end
|
7
95
|
end
|
data/lib/easemob/version.rb
CHANGED
data/lib/easemob.rb
CHANGED
@@ -4,8 +4,16 @@ require 'connection_pool'
|
|
4
4
|
require 'easemob/version'
|
5
5
|
require 'easemob/token'
|
6
6
|
require 'easemob/users'
|
7
|
+
require 'easemob/groups'
|
8
|
+
require 'easemob/chatrooms'
|
9
|
+
require 'easemob/chatlog'
|
10
|
+
require 'easemob/fileoperation'
|
11
|
+
require 'easemob/messages'
|
7
12
|
|
8
13
|
module Easemob
|
14
|
+
class UserNameError < RuntimeError; end
|
15
|
+
class QuotaLimitError < RuntimeError; end
|
16
|
+
|
9
17
|
class << self
|
10
18
|
attr_accessor :client_id # 使用 APP 的 client_id
|
11
19
|
attr_accessor :client_secret # 和 client_secret 获取授权管理员 token
|
@@ -22,40 +30,36 @@ module Easemob
|
|
22
30
|
@random_generator = Random.new
|
23
31
|
@http_pool = 5
|
24
32
|
@http_timeout = 5
|
33
|
+
@token_file_path = nil
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.httprbs
|
35
|
-
@httprbs ||= ConnectionPool.new(size: @http_pool, timeout: @http_timeout) { HTTP.persistent @base_url }
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.do_post(resource, body_hash)
|
35
|
+
# Make an HTTP request with the given verb to easemob server
|
36
|
+
# @param verb [Symbol]
|
37
|
+
# @param resource [String]
|
38
|
+
# @option options [Hash]
|
39
|
+
# @return [HTTP::Response]
|
40
|
+
def self.request(verb, resource, options = {})
|
39
41
|
httprbs.with do |http|
|
40
|
-
res =
|
42
|
+
res = do_request(verb, http, resource, options)
|
41
43
|
case res.code
|
42
44
|
# 401:(未授权)请求要求身份验证。对于需要 token 的接口,服务器可能返回此响应。
|
43
|
-
when 401
|
45
|
+
when 401
|
44
46
|
Token.refresh
|
45
|
-
res =
|
47
|
+
res = do_request(verb, http, resource, options)
|
46
48
|
# 408:(请求超时)服务器等候请求时发生超时。
|
47
49
|
when 408
|
48
|
-
res =
|
50
|
+
res = do_request(verb, http, resource, options)
|
51
|
+
# 503:(服务不可用)请求接口超过调用频率限制,即接口被限流。
|
52
|
+
when 429, 503
|
53
|
+
sleep 1
|
54
|
+
res = do_request(verb, http, resource, options)
|
55
|
+
raise QuotaLimitError, 'Return http status code is 429/503, hit quota limit of Easemob service,' if [429, 503].include?(res.code)
|
49
56
|
end
|
50
57
|
res
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
.post "#{head_url}/#{resource}", json: body_hash
|
57
|
-
end
|
58
|
-
|
61
|
+
# Get admin access token from easemob server
|
62
|
+
# @return access_token [String]
|
59
63
|
def self.token
|
60
64
|
# Possible two worker running, one worker refresh token, other unaware, so must read every time
|
61
65
|
access_token, remain_life_seconds = Token.read_from_store
|
@@ -63,7 +67,50 @@ module Easemob
|
|
63
67
|
access_token
|
64
68
|
end
|
65
69
|
|
70
|
+
def self.chatfile_url(chatfile_uuid)
|
71
|
+
"#{@base_url}/#{@org_name}/#{@app_name}/chatfiles/#{chatfile_uuid}"
|
72
|
+
end
|
73
|
+
|
66
74
|
class << self
|
67
75
|
include Users
|
76
|
+
include Groups
|
77
|
+
include Chatrooms
|
78
|
+
include Chatlog
|
79
|
+
include Fileoperation
|
80
|
+
include Messages
|
81
|
+
end
|
82
|
+
|
83
|
+
private_class_method
|
84
|
+
|
85
|
+
def self.do_request(verb, http, resource, options)
|
86
|
+
http = http.headers('Authorization' => "Bearer #{token}")
|
87
|
+
case verb
|
88
|
+
when :upload
|
89
|
+
restrict_access = options.delete(:restrict_access) || true
|
90
|
+
http.headers('restrict-access' => restrict_access)
|
91
|
+
.request(:post, "#{head_url}/#{resource}", options)
|
92
|
+
when :download
|
93
|
+
header = { 'Accept' => 'application/octet-stream' }
|
94
|
+
share_secret = options.delete(:share_secret)
|
95
|
+
header['share-secret'] = share_secret unless share_secret.nil?
|
96
|
+
thumbnail = options.delete(:thumbnail)
|
97
|
+
header['thumbnail'] = thumbnail if thumbnail
|
98
|
+
http.headers(header)
|
99
|
+
.request(:get, "#{head_url}/#{resource}")
|
100
|
+
else
|
101
|
+
http.request(verb, "#{head_url}/#{resource}", options)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.httprbs
|
106
|
+
@httprbs ||= ConnectionPool.new(size: @http_pool, timeout: @http_timeout) { HTTP.persistent @base_url }
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.head_url
|
110
|
+
"#{@base_url}/#{@org_name}/#{@app_name}"
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.token_file_path
|
114
|
+
@token_file_path || "/tmp/easemob_#{@org_name}_#{@app_name}_token"
|
68
115
|
end
|
69
116
|
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easemob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Guo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRMwEQYDVQQDDAplcmlj
|
14
|
+
Lmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
|
15
|
+
b20wHhcNMTYwNzExMTUyMTU2WhcNMTcwNzExMTUyMTU2WjBBMRMwEQYDVQQDDApl
|
16
|
+
cmljLmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
17
|
+
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6LSiHb79c6Krm
|
18
|
+
TeoHq5fko/QJownbKLtlzHmWCGb6B38mIPqYZBSmfaK9EZr6DTf7TJWB7e/u2+Ep
|
19
|
+
bXCqdUxRDbQZig52DvKfljfgOD/YzALHKAckuk/sskvM2pdtRIowJSYAG/Hz2j1d
|
20
|
+
mngRZaIDd/09CNttRsgCDXZl+qqsNJKCQWZ3T8OdqmlpwkIxo7llKEQ578fQwgZ3
|
21
|
+
8uE4RLMv8fOdFv0EzGXbRyFLCT2WEAH5Ns2Jv12KKbvYCTICdJ36cSV8hOUZT0fG
|
22
|
+
y4FxEXtV9uJVJv3BJ5LE84TWdNiMI1lbFul72p09vebUe2N0Hru3XDnfq69XJ+9e
|
23
|
+
nZC9MFk/AgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
24
|
+
BBR/fjIribDcJvWvxPh+zv2kFGRAejAfBgNVHREEGDAWgRRlcmljLmd1b2N6QGdt
|
25
|
+
YWlsLmNvbTAfBgNVHRIEGDAWgRRlcmljLmd1b2N6QGdtYWlsLmNvbTANBgkqhkiG
|
26
|
+
9w0BAQUFAAOCAQEAIA++aoEJOSbTwQml1cQ+z2psV2R18HKYR7ZM8bGEm9PxGyLt
|
27
|
+
DcpqGIL65VctVjqVzD4RTvDrsFhVICL5o0rLYpC4Qm5jBpx+E2s/akJSDsQcOO12
|
28
|
+
qk+IDlQHJjhf7DOg0+XAIj1/QTvq8s3QrrD8NRoIvGcAXVzqAafcG9NOGIXpqFS1
|
29
|
+
ZdwgixrYZK4p/Z+qIJFiuGvBauegUn0x7WDln52cWXgb+a/oYPBjGtBAZznhSy+R
|
30
|
+
R5k6Ma92sW8jupX4cqbSu9rntdVQkNRpoHIrfU0MZT0cKsg/D1zMteylxrO3KMsz
|
31
|
+
SPQRv+nrI1J0zevFqb8010heoR8SDyUA0Mm3+Q==
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2016-10-17 00:00:00.000000000 Z
|
12
34
|
dependencies:
|
13
35
|
- !ruby/object:Gem::Dependency
|
14
36
|
name: http
|
@@ -92,13 +114,14 @@ dependencies:
|
|
92
114
|
- - "~>"
|
93
115
|
- !ruby/object:Gem::Version
|
94
116
|
version: '3.5'
|
95
|
-
description: Helping rubyist integration with
|
117
|
+
description: Helping rubyist integration with Easemob IM service (环信 - 即时通讯云) easier.
|
96
118
|
email:
|
97
119
|
- eric.guocz@gmail.com
|
98
120
|
executables: []
|
99
121
|
extensions: []
|
100
122
|
extra_rdoc_files: []
|
101
123
|
files:
|
124
|
+
- ".codeclimate.yml"
|
102
125
|
- ".gitignore"
|
103
126
|
- ".rspec"
|
104
127
|
- ".rubocop.yml"
|
@@ -106,6 +129,11 @@ files:
|
|
106
129
|
- LICENSE.txt
|
107
130
|
- README.md
|
108
131
|
- lib/easemob.rb
|
132
|
+
- lib/easemob/chatlog.rb
|
133
|
+
- lib/easemob/chatrooms.rb
|
134
|
+
- lib/easemob/fileoperation.rb
|
135
|
+
- lib/easemob/groups.rb
|
136
|
+
- lib/easemob/messages.rb
|
109
137
|
- lib/easemob/token.rb
|
110
138
|
- lib/easemob/users.rb
|
111
139
|
- lib/easemob/version.rb
|
@@ -132,5 +160,5 @@ rubyforge_project:
|
|
132
160
|
rubygems_version: 2.6.7
|
133
161
|
signing_key:
|
134
162
|
specification_version: 4
|
135
|
-
summary: An unofficial
|
163
|
+
summary: An unofficial Easemob IM(instant message) service integration gem
|
136
164
|
test_files: []
|
metadata.gz.sig
ADDED