tim_sdk 0.1.2 → 0.1.3

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: 6356b1ff18102c5a565f654ed7863610ecfabdc20925d8993fdd91351baa41e9
4
- data.tar.gz: 81c20853863aec9ce1c03b655f46bce25685959c38a51ec4dc78369d498b3e70
3
+ metadata.gz: 7cbd2bbc3b9aa2b89b6b05560ff1f43fa2bead8b14147a96201c9bef8882e2d5
4
+ data.tar.gz: ab03db61a147d809b00965cf5ed9f33cd2389f62213aa85726df78c9ddbe42af
5
5
  SHA512:
6
- metadata.gz: 428bee9465e375510a223cc1efafd407f787424c305fc33d2ac9037ad236d926e442d4cc7317d57d175062b0740b6e5f3ababa278bda32b9bef4d798ce98694c
7
- data.tar.gz: 30d4dec6bfb9ae31b5efc7d7770809592a45fa39f22092d56ca7138c94b87028aa80317fd4442bb8562c9a6be143db32089738026e7a012800496a4788994783
6
+ metadata.gz: d00e806e56a05e958c3063e1b280d10f46d1cea2bd610d6d29db6d932491b4e47c71b77b6422a893aad20a076dd4bdc40c301b1075d6e3af50e0b50c24edbdf2
7
+ data.tar.gz: b0c110e06d0a991e114f23496475bce6fb823f71ab8655d92b9a4f0409fca25863451f79f6e3b77600db3e522e0479d7b8d199b3636603f963d580066a1c9494
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ *.gem
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tim_sdk (0.1.1)
4
+ tim_sdk (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1 +1,159 @@
1
- # TimSdk
1
+ # TimSdk
2
+
3
+ [腾讯云即时通信IM](https://cloud.tencent.com/product/im) Ruby SDK。提供登录签名和部分常用的 API 接口。已经完成的功能:
4
+
5
+ - [x] 用户登录即时通信签名
6
+ - [x] 服务端计算 UserSig
7
+
8
+ - [x] 账号管理
9
+ - [x] 导入单个账号
10
+ - [x] 导入多个帐号
11
+ - [x] 删除帐号
12
+ - [x] 查询帐号
13
+ - [x] 失效帐号登录态
14
+ - [x] 查询帐号在线状态
15
+
16
+ - [x] 资料管理
17
+ - [x] 设置资料
18
+ - [x] 拉取资料
19
+
20
+ - [x] 运营管理
21
+ - [x] 拉取运营数据
22
+ - [x] 下载消息记录
23
+ - [x] 获取服务器 IP 地址
24
+
25
+ ## Installation
26
+
27
+ Add this line to your application's Gemfile:
28
+
29
+ ```ruby
30
+ gem 'tim_sdk'
31
+ ```
32
+
33
+ And then execute:
34
+
35
+ $ bundle install
36
+
37
+ Or install it yourself as:
38
+
39
+ $ gem install tim_sdk
40
+
41
+ ## Usage
42
+
43
+ 配置参数
44
+ ```ruby
45
+ TimSdk.configure do |config|
46
+ config.app_id = 'you app id'
47
+ config.admin_account = 'you admin account'
48
+ config.app_key = 'you app key'
49
+ end
50
+ ```
51
+
52
+ 生成UserSig
53
+ ```ruby
54
+ TimSdk::Sign.signature('10001')
55
+ #=> eJyrVgrxCdYrzkxXslJQ8jA0dkoN99LOTXNONrHwca0K8Qmv0NY3zqxICfU3zAqscvMqLcxPNHYyLrdV0lEAa02tKMgsSgXqtjAzMTCAChanZCcWFGSmgAytzC9VAHIUgDyobFlqEUjCSM8AJlKSmQsywtDMwMDQ1MTcwgQqnpmSmleSmZYJ0WBoAJRWqgUASukybQ__
56
+ TimSdk::Sign.signature('10001', 7 * 24 * 60 * 60)
57
+ #=> eJyrVgrxCdYrzkxXslJQ8jA0dkoN99LOTXNONrHwca0K8Qmv0NY3zqxICfU3zAqscvMqLcxPNHYyLrdV0lEAa02tKMgsSgXqtjAzMTCAChanZCcWFGSmgAytzC9VAHIUgDyobFlqEUjCSM8AJlKSmQsywtDMwMDQ1MTcwgQqnpmSmleSmZYJ0WBoAJRWqgUASukybQ__
58
+ ```
59
+
60
+ 导入单个账号
61
+ ```ruby
62
+ TimSdk::Api.invoke_account_import('foo')
63
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>""}
64
+ ```
65
+
66
+ 导入多个帐号
67
+ ```ruby
68
+ TimSdk::Api.invoke_multi_account_import(%w[foo bar])
69
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>"", :FailAccounts=>[]}
70
+ ```
71
+
72
+ 删除帐号
73
+ ```ruby
74
+ TimSdk::Api.invoke_account_delete(%w[foo bar])
75
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>"", :ResultItem=>[{:ResultCode=>0, :ResultInfo=>"", :UserID=>"bar"}, {:ResultCode=>0, :ResultInfo=>"", :UserID=>"foo"}]}
76
+ ```
77
+
78
+ 查询帐号
79
+ ```ruby
80
+ TimSdk::Api.invoke_account_check(%w[foo bar])
81
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>"", :ResultItem=>[{:AccountStatus=>"Imported", :ResultCode=>0, :ResultInfo=>"", :UserID=>"bar"}, {:AccountStatus=>"Imported", :ResultCode=>0, :ResultInfo=>"", :UserID=>"foo"}]}
82
+ ```
83
+
84
+ 失效帐号登录态
85
+ ```ruby
86
+ TimSdk::Api.invoke_kick('foo')
87
+ #=> {:ActionStatus=>"OK", :ErrorInfo=>"", :ErrorCode=>0}
88
+ ```
89
+
90
+ 查询帐号在线状态
91
+ ```ruby
92
+ TimSdk::Api.invoke_query_state(%w[foo bar])
93
+ #=> {:ActionStatus=>"OK", :ErrorInfo=>"", :ErrorCode=>0, :QueryResult=>[{:To_Account=>"bar", :State=>"Offline", :Status=>"Offline"}, {:To_Account=>"foo", :State=>"Offline", :Status=>"Offline"}]}
94
+ ```
95
+
96
+ 设置资料
97
+ ```ruby
98
+ TimSdk::Api.invoke_portrait_set('foo', [
99
+ { tag: 'Tag_Profile_IM_Nick', value: 'vincent', },
100
+ { tag: 'Tag_Profile_IM_Image', value: 'https://example.com/avatar.png' },
101
+ ])
102
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>"", :ErrorDisplay=>""}
103
+ ```
104
+
105
+ 拉取资料
106
+ ```ruby
107
+ TimSdk::Api.invoke_portrait_get(%w[foo bar], %w[Tag_Profile_IM_Nick Tag_Profile_IM_Image])
108
+ #=> {:UserProfileItem=>[{:To_Account=>"bar", :ResultCode=>0, :ResultInfo=>""}, {:To_Account=>"foo", :ProfileItem=>[{:Tag=>"Tag_Profile_IM_Nick", :Value=>"vincent"}, {:Tag=>"Tag_Profile_IM_Image", :Value=>"https://example.com/avatar.png"}], :ResultCode=>0, :ResultInfo=>""}], :CurrentStandardSequence=>0, :ActionStatus=>"OK", :ErrorCode=>0, :ErrorInfo=>"", :ErrorDisplay=>""}
109
+ ```
110
+
111
+ 拉取运营数据
112
+ ```ruby
113
+ TimSdk::Api.invoke_fetch_app_info
114
+ #=> {:ErrorCode=>0, :ErrorInfo=>"OK", :Result=>[{:Date=>"20200914"}, {:Date=>"20200913"}, {:Date=>"20200912"}, {:Date=>"20200911"}, {:Date=>"20200910"}, {:Date=>"20200909"}, {:Date=>"20200908"}, {:Date=>"20200907"}, {:Date=>"20200906"}, {:Date=>"20200905"}, {:Date=>"20200904"}, {:Date=>"20200903"}, {:Date=>"20200902"}, {:Date=>"20200901"}, {:Date=>"20200831"}, {:Date=>"20200830"}, {:Date=>"20200829"}, {:Date=>"20200828"}, {:Date=>"20200827"}, {:Date=>"20200826"}, {:Date=>"20200825"}, {:Date=>"20200824"}, {:Date=>"20200823"}, {:Date=>"20200822"}, {:Date=>"20200821"}, {:Date=>"20200820"}, {:Date=>"20200819"}, {:Date=>"20200818"}, {:Date=>"20200817"}, {:Date=>"20200816"}]}
115
+ ```
116
+
117
+ 下载消息记录
118
+ ```ruby
119
+ TimSdk::Api.invoke_fetch_history('C2C', '2020091116')
120
+ #=> {:ChatType=>"C2C", :MsgTime=>"2020091116", :File=>[{:URL=>"https://download.tim.qq.com/msg_history/4/f5da9cce4789eda2f72511ea89280c42a1292b80.gz", :ExpireTime=>"2020-09-15 15:50:07", :FileSize=>7273, :FileMD5=>"6fde5543bbc4a5aea5e35a64edf0553e", :GzipSize=>1535, :GzipMD5=>"92a00693794328453010e083e8193eed"}], :ActionStatus=>"OK", :ErrorInfo=>"", :ErrorCode=>0}
121
+ ```
122
+
123
+ 获取服务器 IP 地址
124
+ ```ruby
125
+ TimSdk::Api.invoke_fetch_ip_list
126
+ #=> {:ActionStatus=>"OK", :ErrorCode=>0, :IPList=>["101.226.212.0/25", "101.226.233.0/25", "101.89.18.0/25", "101.91.60.0/25", "101.91.69.0/25", "101.91.96.0/25", "106.52.138.0/25", "106.52.142.0/25", "106.52.145.0/25", "106.52.14.0/25", "106.52.148.0/25", "106.52.159.0/25", "106.52.164.0/25", "106.52.165.0/25", "106.52.172.0/25", "106.52.178.0/25", "106.52.180.0/25", "106.52.183.0/25", "106.52.187.0/25", "106.52.190.0/25", "106.52.201.0/25", "106.52.29.0/25", "106.52.32.0/25", "106.53.102.0/25", "106.53.125.0/25", "106.53.203.0/25", "106.53.76.0/25", "106.55.14.0/25", "106.55.15.0/25", "106.55.17.0/25", "106.55.173.0/25", "106.55.18.0/25", "106.55.249.0/25", "106.55.253.0/25", "111.13.35.0/25", "111.161.111.0/25", "111.161.64.0/25", "111.30.138.0/25", "111.30.144.0/25", "111.30.155.0/25", "113.96.237.0/25", "116.128.138.0/25", "116.128.146.0/25", "116.128.160.0/25", "116.128.163.0/25", "117.135.172.0/25", "117.144.244.0/25", "117.184.248.0/25", "118.126.91.0/25", "118.89.30.0/25", "118.89.64.0/25", "119.29.105.0/25", "119.29.130.0/25", "119.29.147.0/25", "119.29.191.0/25", "119.29.72.0/25", "119.29.73.0/25", "119.29.74.0/25", "119.29.77.0/25", "119.45.147.0/25", "119.45.33.0/25", "119.45.41.0/25", "119.45.43.0/25", "119.45.44.0/25", "119.45.46.0/25", "119.45.47.0/25", "120.204.11.0/25", "120.232.21.0/25", "121.51.131.0/25", "121.51.132.0/25", "121.51.141.0/25", "121.51.158.0/25", "121.51.176.0/25", "121.51.74.0/25", "121.51.90.0/25", "123.126.122.0/25", "123.150.174.0/25", "123.151.137.0/25", "123.151.179.0/25", "123.151.190.0/25", "123.151.72.0/25", "123.151.79.0/25", "123.207.31.0/25", "125.39.133.0/25", "129.204.177.0/25", "129.204.186.0/25", "129.204.73.0/25", "129.211.162.0/25", "129.211.163.0/25", "129.211.181.0/25", "129.211.182.0/25", "134.175.142.0/25", "134.175.161.0/25", "134.175.205.0/25", "134.175.227.0/25", "14.18.180.0/25", "157.255.196.0/25", "157.255.243.0/25", "163.177.56.0/25", "180.163.32.0/25", "182.254.21.0/25", "182.254.34.0/25", "182.254.50.0/25", "182.254.51.0/25", "182.254.56.0/25", "182.254.57.0/25", "182.254.78.0/25", "182.254.86.0/25", "183.192.172.0/25", "183.192.173.0/25", "183.192.202.0/25", "183.194.184.0/25", "183.232.125.0/25", "183.232.95.0/25", "183.232.96.0/25", "183.3.225.0/25", "193.112.125.0/25", "193.112.151.0/25", "193.112.153.0/25", "193.112.169.0/25", "203.205.232.0/25", "203.205.254.0/25", "220.249.243.0/25", "223.167.154.0/25", "36.155.230.0/25", "42.194.134.0/25", "42.194.145.0/25", "42.194.168.0/25", "42.194.192.0/25", "42.194.224.0/25", "42.194.225.0/25", "58.247.206.0/25", "58.250.136.0/25", "58.60.9.0/25", "59.36.121.0/25", "59.37.116.0/25", "59.37.97.0/25", "61.151.206.0/25", "81.71.1.0/25", "81.71.3.0/25", "81.71.6.0/25", "182.254.116.116", "162.14.6.247"]}
127
+ ```
128
+
129
+
130
+ ## Development
131
+
132
+ 运行 `rspec` 前请先配置正确的参数
133
+ ```ruby
134
+ # ./spec/tim_sdk_spec.rb
135
+ before(:all) do
136
+ TimSdk.configure do |config|
137
+ config.app_id = 'you app id'
138
+ config.admin_account = 'you admin account'
139
+ config.app_key = 'you app key'
140
+ end
141
+ end
142
+ ```
143
+
144
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
145
+
146
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
147
+
148
+ ## Contributing
149
+
150
+ Bug reports and pull requests are welcome on GitHub at https://github.com/JiangYongKang/tim_sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/JiangYongKang/tim_sdk/blob/master/CODE_OF_CONDUCT.md).
151
+
152
+
153
+ ## License
154
+
155
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
156
+
157
+ ## Code of Conduct
158
+
159
+ Everyone interacting in the Test project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/JiangYongKang/tim_sdk/blob/master/CODE_OF_CONDUCT.md).
@@ -4,7 +4,7 @@ module TimSdk
4
4
  class Api
5
5
 
6
6
  def self.connection
7
- @connection ||= Faraday.new('https://console.tim.qq.com', params: {
7
+ Faraday.new('https://console.tim.qq.com', params: {
8
8
  sdkappid: TimSdk.configuration.app_id,
9
9
  identifier: TimSdk.configuration.admin_account,
10
10
  usersig: TimSdk::Sign.signature(TimSdk.configuration.admin_account),
@@ -1,3 +1,3 @@
1
1
  module TimSdk
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tim_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiangYongKang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a ruby program to facilitate accessing tim service
14
14
  email: