wework 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +82 -24
- data/lib/wework/request.rb +2 -2
- data/lib/wework/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: 70b672be89cd333efb0850b76f1ac92c23c4f4b15b10c2669a853349cdae6bc0
|
4
|
+
data.tar.gz: bf4de5465f6b479862848b9c18929e967a024570ccdf5586456578ad42c97d5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2def5480b4c8f39e578089020534e82d8d59b95c137680785c9ee8785cc4293c962bddc024b81ff8b85ebb8ba579fd9b807485d212234e13d390a2b15bad7f4
|
7
|
+
data.tar.gz: 449fd74e76c0d36c788ed0a1ae833e05239527ca94801ddebab379eda54520d856d22ebbc81569dd0f1c44669df358952d0b70a023c64467845c7d6ee1d04dc6
|
data/README.md
CHANGED
@@ -4,28 +4,6 @@ Wework is a ruby API wrapper for work wechat.
|
|
4
4
|
|
5
5
|
[![CircleCI](https://circleci.com/gh/mycolorway/wework/tree/suite.svg?style=svg)](https://circleci.com/gh/mycolorway/wework/tree/suite)
|
6
6
|
|
7
|
-
## Version 1.1.0
|
8
|
-
* 支持第三方应用接口
|
9
|
-
* 支持小程序接口
|
10
|
-
|
11
|
-
|
12
|
-
## Version 0.1.4
|
13
|
-
* 异步任务接口 [doc](https://work.weixin.qq.com/api/doc#10138)
|
14
|
-
|
15
|
-
## Version 0.1.3
|
16
|
-
|
17
|
-
* `access_token` 和 `jsapi_ticket` 管理存储 (默认 redis, 支持其它扩展)
|
18
|
-
* 通信录相关接口 [Wework::Api::Contact](https://github.com/mycolorway/wework/blob/master/lib/wework/api/contact.rb)
|
19
|
-
* 企业微信应用接口 [Wework::Api::Agent](https://github.com/mycolorway/wework/blob/master/lib/wework/api/agent.rb)
|
20
|
-
* API 集成 [Wework::Engine](https://github.com/mycolorway/wework/blob/master/lib/wework/engine.rb)
|
21
|
-
* 网页授权及[JS-SDK签名算法](https://work.weixin.qq.com/api/doc#10029/附录1-JS-SDK使用权限签名算法)
|
22
|
-
|
23
|
-
### TODO:
|
24
|
-
|
25
|
-
* 完善测试用例
|
26
|
-
* 消息接收 [doc](https://work.weixin.qq.com/api/doc#10427)
|
27
|
-
|
28
|
-
|
29
7
|
## Installation
|
30
8
|
|
31
9
|
Add this line to your application's Gemfile:
|
@@ -44,7 +22,87 @@ Or install it yourself as:
|
|
44
22
|
|
45
23
|
## Usage
|
46
24
|
|
47
|
-
|
25
|
+
#### 第三方应用
|
26
|
+
|
27
|
+
1). 初始化套件接口 [Wework::Api::Suite](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/suite.rb)
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
$wework_suite = Wework::Api::Suite.new(
|
31
|
+
corp_id: ENV['WEWORK_CORPID'], # 应用服务商 CorpID
|
32
|
+
suite_id: ENV['WEWORK_SUITE_ID'], # SuiteID
|
33
|
+
encoding_aes_key: ENV['WEWORK_SUITE_ENCODING_AES_KEY'], # EncodingAESKey
|
34
|
+
suite_token: ENV['WEWORK_SUITE_TOKEN'], # Token
|
35
|
+
suite_secret: ENV['WEWORK_SUITE_SECRET'] # Secret
|
36
|
+
)
|
37
|
+
```
|
38
|
+
[套件接口列表](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/suite.rb)
|
39
|
+
|
40
|
+
2). 获取授权企业应用API [Wework::Api::Agent](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/agent.rb)
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
agent_api = $wework_suite.corp(
|
44
|
+
corp_id, # 授权企业 CorpID
|
45
|
+
permanent_code # 永久授权码
|
46
|
+
)
|
47
|
+
```
|
48
|
+
|
49
|
+
#### 自建应用
|
50
|
+
|
51
|
+
初始化接口 [Wework::Api::Agent](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/agent.rb)
|
52
|
+
|
53
|
+
``` ruby
|
54
|
+
$agent_api = Wework::Api::Agent.new(
|
55
|
+
corp_id: ENV['WEWORK_CORPID'], # 企业 CorpID
|
56
|
+
agent_id: ENV['WEWORK_APPID'], # AgentId
|
57
|
+
secret: ENV['DEMO_APP_SECRET'] # Secret
|
58
|
+
)
|
59
|
+
```
|
60
|
+
|
61
|
+
#### 通讯录同步
|
62
|
+
|
63
|
+
初始化接口 [Wework::Api::Contact](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/contact.rb)
|
64
|
+
|
65
|
+
``` ruby
|
66
|
+
$contact_api = Wework::Api::Contact.new(
|
67
|
+
corp_id: ENV['WEWORK_CORPID'], # 企业 CorpID
|
68
|
+
secret: ENV['DEMO_APP_SECRET'] # 通讯录同步 Secret
|
69
|
+
)
|
70
|
+
```
|
71
|
+
|
72
|
+
#### 应用服务商接口 (单点登录)
|
73
|
+
|
74
|
+
初始化
|
75
|
+
|
76
|
+
``` ruby
|
77
|
+
$provider_api = Wework::Api::Provider.new(
|
78
|
+
corp_id: ENV['WEWORK_PROVIDER_CORPID'], # 应用服务商 CorpID
|
79
|
+
secret: ENV['WEWORK_PROVIDER_SECRET'] # Secret
|
80
|
+
)
|
81
|
+
```
|
82
|
+
|
83
|
+
|
84
|
+
## Methods
|
85
|
+
|
86
|
+
[Wework::Api::Methods::Agent](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/agent.rb)
|
87
|
+
|
88
|
+
[Wework::Api::Methods::User](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/user.rb)
|
89
|
+
|
90
|
+
[Wework::Api::Methods::Department](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/department.rb)
|
91
|
+
|
92
|
+
[Wework::Api::Methods::Message](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/message.rb)
|
93
|
+
|
94
|
+
[Wework::Api::Methods::Media](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/media.rb)
|
95
|
+
|
96
|
+
[Wework::Api::Methods::Menu](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/menu.rb)
|
97
|
+
|
98
|
+
[Wework::Api::Methods::Approval](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/approval.rb)
|
99
|
+
|
100
|
+
[Wework::Api::Methods::Checkin](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/checkin.rb)
|
101
|
+
|
102
|
+
[Wework::Api::Methods::Provider](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/provider.rb)
|
103
|
+
|
104
|
+
[Wework::Api::Methods::Suite](https://github.com/mycolorway/wework/blob/suite/lib/wework/api/methods/suite.rb)
|
105
|
+
|
48
106
|
|
49
107
|
## Contributing
|
50
108
|
|
@@ -57,5 +115,5 @@ TODO: ...
|
|
57
115
|
|
58
116
|
## License
|
59
117
|
|
60
|
-
Copyright (c)
|
118
|
+
Copyright (c) 2018 MyColorway. See LICENSE.txt for further details.
|
61
119
|
|
data/lib/wework/request.rb
CHANGED
@@ -10,7 +10,7 @@ module Wework
|
|
10
10
|
@base = base
|
11
11
|
@httprb = HTTP.timeout(**Wework.http_timeout_options)
|
12
12
|
@ssl_context = OpenSSL::SSL::SSLContext.new
|
13
|
-
@ssl_context.ssl_version = :
|
13
|
+
@ssl_context.ssl_version = :TLSv1
|
14
14
|
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE if skip_verify_ssl
|
15
15
|
end
|
16
16
|
|
@@ -52,7 +52,7 @@ module Wework
|
|
52
52
|
parse_response(response, as || :json) do |parse_as, data|
|
53
53
|
break data unless parse_as == :json
|
54
54
|
result = Wework::Result.new(data)
|
55
|
-
Rails.logger.info "[WEWORK] request path(#{url_base}#{path}): #{result.inspect}" if defined?(Rails)
|
55
|
+
#Rails.logger.info "[WEWORK] request path(#{url_base}#{path}): #{result.inspect}" if defined?(Rails)
|
56
56
|
raise AccessTokenExpiredError if result.token_expired?
|
57
57
|
result
|
58
58
|
end
|
data/lib/wework/version.rb
CHANGED