wework 1.2.5 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wework.rb +3 -2
- data/lib/wework/api/agent.rb +1 -0
- data/lib/wework/api/methods/agent.rb +5 -0
- data/lib/wework/api/provider.rb +0 -8
- data/lib/wework/api/suite.rb +1 -2
- data/lib/wework/cipher.rb +8 -0
- data/lib/wework/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2370a71d7a4ebb3f04257eee4d1573748cfcc5e15ade5931a973d8abcfbe790b
|
4
|
+
data.tar.gz: 9340553291b76e20b4f8db91caeadd7455cd11489a78e45f210d2e5a60e02e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2100dbeb253d7fd17723c440d016f24510ef8215145099bbbf9c80b46411f52089b2cdbf8bf36c458dc21e1266d753945def2c83bbc052773f5dbee78048ee15
|
7
|
+
data.tar.gz: 4f7ce15118f59d0843e97e9fbd2adfec40b638fe02dc6e46ea2e00b36d9c97179f78f8b2681e30dc67e400b3e0cf03d5f0179e22d4cc9d02f7373c689134091c
|
data/lib/wework.rb
CHANGED
@@ -2,8 +2,8 @@ require 'redis'
|
|
2
2
|
require 'active_support/all'
|
3
3
|
#require 'active_support/core_ext/object/blank'
|
4
4
|
|
5
|
-
|
6
|
-
Dir["#{
|
5
|
+
lib_path = "#{File.dirname(__FILE__)}/wework"
|
6
|
+
Dir["#{lib_path}/api/methods/*.rb", "#{lib_path}/token/*.rb"].each { |path| require path }
|
7
7
|
|
8
8
|
require 'wework/version'
|
9
9
|
require 'wework/cipher'
|
@@ -20,6 +20,7 @@ module Wework
|
|
20
20
|
API_ENDPOINT = 'https://qyapi.weixin.qq.com/cgi-bin/'.freeze
|
21
21
|
AUTHORIZE_ENDPOINT = 'https://open.weixin.qq.com/connect/oauth2/authorize'.freeze
|
22
22
|
SSO_AUTHORIZE_ENDPOINT = 'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect'.freeze
|
23
|
+
AGENT_SSO_AUTHORIZE_ENDPOINT = 'https://open.work.weixin.qq.com/wwopen/sso/qrConnect'.freeze
|
23
24
|
APP_AUTHORIZE_ENDPOINT = 'https://open.work.weixin.qq.com/3rdapp/install'.freeze
|
24
25
|
REGISTER_ENDPOINT = 'https://open.work.weixin.qq.com/3rdservice/wework/register'.freeze
|
25
26
|
HTTP_OK_STATUS = [200, 201].freeze
|
data/lib/wework/api/agent.rb
CHANGED
@@ -4,6 +4,11 @@ module Wework
|
|
4
4
|
module Api
|
5
5
|
module Methods
|
6
6
|
module Agent
|
7
|
+
def sso_authorize_url(redirect_uri, state='qrconnect')
|
8
|
+
uri = ERB::Util.url_encode(redirect_uri)
|
9
|
+
"#{AGENT_SSO_AUTHORIZE_ENDPOINT}?appid=#{corp_id}&agentid=#{agent_id}&redirect_uri=#{uri}&state=#{state}"
|
10
|
+
end
|
11
|
+
|
7
12
|
def authorize_url(redirect_uri, scope="snsapi_base", state="wxwork")
|
8
13
|
# user agent: UA is mozilla/5.0 (iphone; cpu iphone os 10_2 like mac os x) applewebkit/602.3.12 (khtml, like gecko) mobile/14c92 wxwork/1.3.2 micromessenger/6.2
|
9
14
|
uri = ERB::Util.url_encode(redirect_uri)
|
data/lib/wework/api/provider.rb
CHANGED
@@ -4,14 +4,6 @@ module Wework
|
|
4
4
|
include Methods::Provider
|
5
5
|
include Wework::Cipher
|
6
6
|
|
7
|
-
attr_reader :encoding_aes_key, :token
|
8
|
-
|
9
|
-
def initialize(options={})
|
10
|
-
@token = options.delete(:token)
|
11
|
-
@encoding_aes_key = options.delete(:encoding_aes_key)
|
12
|
-
super(options)
|
13
|
-
end
|
14
|
-
|
15
7
|
private
|
16
8
|
|
17
9
|
def token_store
|
data/lib/wework/api/suite.rb
CHANGED
@@ -7,13 +7,12 @@ module Wework
|
|
7
7
|
include Wework::Cipher
|
8
8
|
include Methods::Service
|
9
9
|
|
10
|
-
attr_reader :
|
10
|
+
attr_reader :suite_id, :suite_secret, :suite_token
|
11
11
|
|
12
12
|
def initialize(options={})
|
13
13
|
@suite_id = options.delete(:suite_id)
|
14
14
|
@suite_secret = options.delete(:suite_secret)
|
15
15
|
@token = @suite_token = options.delete(:suite_token)
|
16
|
-
@encoding_aes_key = options.delete(:encoding_aes_key)
|
17
16
|
super(options)
|
18
17
|
end
|
19
18
|
|
data/lib/wework/cipher.rb
CHANGED
@@ -11,6 +11,14 @@ module Wework
|
|
11
11
|
BLOCK_SIZE = 32
|
12
12
|
CIPHER = 'AES-256-CBC'.freeze
|
13
13
|
|
14
|
+
def token
|
15
|
+
@token ||= options[:token]
|
16
|
+
end
|
17
|
+
|
18
|
+
def encoding_aes_key
|
19
|
+
@encoding_aes_key ||= options[:encoding_aes_key]
|
20
|
+
end
|
21
|
+
|
14
22
|
def encrypt(plain, encoding_aes_key)
|
15
23
|
cipher = OpenSSL::Cipher.new(CIPHER)
|
16
24
|
cipher.encrypt
|
data/lib/wework/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- seandong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
251
|
requirements: []
|
252
|
-
rubygems_version: 3.
|
252
|
+
rubygems_version: 3.1.2
|
253
253
|
signing_key:
|
254
254
|
specification_version: 4
|
255
255
|
summary: Ruby API wrapper for wechat work「企业微信」
|