tim_sdk 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cbd2bbc3b9aa2b89b6b05560ff1f43fa2bead8b14147a96201c9bef8882e2d5
4
- data.tar.gz: ab03db61a147d809b00965cf5ed9f33cd2389f62213aa85726df78c9ddbe42af
3
+ metadata.gz: 03e0b33df1b7960bef8fb7bb33338885d8ec78c9b820e9e9e14c1c30fa22bf57
4
+ data.tar.gz: 361e71cddf1baef18bfab1da454edc5aca8406fdc0b28d5757ae3e2a6d73db1a
5
5
  SHA512:
6
- metadata.gz: d00e806e56a05e958c3063e1b280d10f46d1cea2bd610d6d29db6d932491b4e47c71b77b6422a893aad20a076dd4bdc40c301b1075d6e3af50e0b50c24edbdf2
7
- data.tar.gz: b0c110e06d0a991e114f23496475bce6fb823f71ab8655d92b9a4f0409fca25863451f79f6e3b77600db3e522e0479d7b8d199b3636603f963d580066a1c9494
6
+ metadata.gz: d5438ce5e5f57a343ad691df72b7c4c2d7ee4c8892597cf9f969f7ba6535617ed9a208a3a0bf04e02b21f61072a845c3c87c55f6dee564a09d7425194c134e2a
7
+ data.tar.gz: c0a9c7aec4117097a594e8dba478a5b0886f1a4ac2a241063f015830f411ecc9e468385447beb0c3738b7026bf695608d618fb5dde6ee910b5f19aa50009b7db
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tim_sdk (0.1.2)
4
+ tim_sdk (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -13,6 +13,9 @@
13
13
  - [x] 失效帐号登录态
14
14
  - [x] 查询帐号在线状态
15
15
 
16
+ - [x] 单聊消息
17
+ - [x] 导入单聊消息
18
+
16
19
  - [x] 资料管理
17
20
  - [x] 设置资料
18
21
  - [x] 拉取资料
@@ -93,6 +96,26 @@ TimSdk::Api.invoke_query_state(%w[foo bar])
93
96
  #=> {:ActionStatus=>"OK", :ErrorInfo=>"", :ErrorCode=>0, :QueryResult=>[{:To_Account=>"bar", :State=>"Offline", :Status=>"Offline"}, {:To_Account=>"foo", :State=>"Offline", :Status=>"Offline"}]}
94
97
  ```
95
98
 
99
+ 导入聊天消息
100
+ ```ruby
101
+ TimSdk::Api.invoke_import_msg(
102
+ 'foo',
103
+ 'bar',
104
+ 4122534,
105
+ 1556178721,
106
+ 2,
107
+ [
108
+ {
109
+ "msg_type": "TIMTextElem",
110
+ "msg_content": {
111
+ "text": "Hello World"
112
+ }
113
+ }
114
+ ]
115
+ )
116
+ #=> {:ActionStatus=>"OK", :ErrorInfo=>"", :ErrorCode=>0}
117
+ ```
118
+
96
119
  设置资料
97
120
  ```ruby
98
121
  TimSdk::Api.invoke_portrait_set('foo', [
@@ -92,6 +92,22 @@ module TimSdk
92
92
  JSON.parse(response.body, symbolize_names: true) if response.success?
93
93
  end
94
94
 
95
+ # 导入单聊消息
96
+ def self.invoke_import_msg(from_account, to_account, msg_random, msg_timestamp, sync_from_old_system, msg_body)
97
+ response = connection.post('/v4/openim/importmsg') do |request|
98
+ request.body = {
99
+ :SyncFromOldSystem => sync_from_old_system,
100
+ :From_Account => from_account.to_s,
101
+ :To_Account => to_account.to_s,
102
+ :MsgRandom => msg_random.to_i,
103
+ :MsgTimeStamp => msg_timestamp.to_i,
104
+ :MsgBody => msg_body
105
+ }.to_json
106
+ end
107
+ raise TimServerError, "Response Status: #{response.status}" unless response.success?
108
+ JSON.parse(response.body, symbolize_names: true) if response.success?
109
+ end
110
+
95
111
  # 设置资料
96
112
  def self.invoke_portrait_set(account, items)
97
113
  response = connection.post('/v4/profile/portrait_set') do |request|
@@ -1,3 +1,3 @@
1
1
  module TimSdk
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tim_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiangYongKang