jpsclient 0.2.0 → 0.3.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
- data/lib/jpsclient/auth/auth.rb +5 -0
- data/lib/jpsclient/auth/token.rb +13 -3
- data/lib/jpsclient/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: 47fe60126882e8f0ef14de2a05200d359978028dbbbcb444914742cbf117d38a
|
4
|
+
data.tar.gz: 6ac66bc49e80a67edeb24eaacc53c6a14203684a1f6f76a2c676eb1ba12d1f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8ceeca4c8d0eb2f92668bc9e5ebf004f8d53e07fcf9c426297a7cc6efa17711c840d4b9bb5424772a855d9c6ab806bb3355290b4a60c6488f690453355cb013
|
7
|
+
data.tar.gz: 10d6e64d98e92271d73b56a6c68380234a1377cf5dbeec53fa9027019f3917bf60c7b75729d3d5b7489fecb51604d69e11744948ff5d0cebb033a66636315ea3
|
data/lib/jpsclient/auth/auth.rb
CHANGED
@@ -18,6 +18,7 @@ module JPSClient
|
|
18
18
|
class LoginConfig
|
19
19
|
attr_accessor :client_id, :feishu_auth_url, :redirect_uri, :api_endpoint, :state, :server_port
|
20
20
|
attr_accessor :aes_key, :token_verify_endpoint
|
21
|
+
attr_accessor :token_dir, :token_file_name # 新增 token 存储路径配置
|
21
22
|
|
22
23
|
def initialize
|
23
24
|
# 所有配置必须从外部配置文件加载,不提供硬编码的默认值
|
@@ -29,6 +30,8 @@ module JPSClient
|
|
29
30
|
@server_port = 8898 # 仅此项可有默认值
|
30
31
|
@aes_key = nil # AES 加密密钥,必需配置
|
31
32
|
@token_verify_endpoint = nil # Token 验证端点,必需配置
|
33
|
+
@token_dir = nil # Token 存储目录,可选配置
|
34
|
+
@token_file_name = nil # Token 文件名,可选配置
|
32
35
|
end
|
33
36
|
|
34
37
|
# 从 JSON 加载配置
|
@@ -47,6 +50,8 @@ module JPSClient
|
|
47
50
|
config.server_port = data['server_port'] if data['server_port']
|
48
51
|
config.token_verify_endpoint = data['token_verify_endpoint'] if data['token_verify_endpoint']
|
49
52
|
config.aes_key = data['aes_key'] if data['aes_key']
|
53
|
+
config.token_dir = data['token_dir'] if data['token_dir'] # 加载 token 目录配置
|
54
|
+
config.token_file_name = data['token_file_name'] if data['token_file_name'] # 加载 token 文件名配置
|
50
55
|
|
51
56
|
config
|
52
57
|
end
|
data/lib/jpsclient/auth/token.rb
CHANGED
@@ -18,9 +18,19 @@ module JPSClient
|
|
18
18
|
@config = config
|
19
19
|
@aes_key = config.aes_key if config
|
20
20
|
|
21
|
-
#
|
22
|
-
|
23
|
-
|
21
|
+
# 从配置中获取 token 存储路径,如果配置中没有则使用默认值
|
22
|
+
if config && config.token_dir && !config.token_dir.empty?
|
23
|
+
@token_dir = File.expand_path(config.token_dir)
|
24
|
+
else
|
25
|
+
@token_dir = File.expand_path('~') # 默认目录
|
26
|
+
end
|
27
|
+
|
28
|
+
# 从配置中获取 token 文件名,如果配置中没有则使用默认值
|
29
|
+
if config && config.token_file_name && !config.token_file_name.empty?
|
30
|
+
@token_file = File.join(@token_dir, config.token_file_name)
|
31
|
+
else
|
32
|
+
@token_file = File.join(@token_dir, '.jpstoken') # 默认文件名
|
33
|
+
end
|
24
34
|
|
25
35
|
# token 数据
|
26
36
|
@token = nil
|
data/lib/jpsclient/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpsclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Your Name
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: faraday
|
@@ -263,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
|
-
rubygems_version: 3.6.
|
266
|
+
rubygems_version: 3.6.9
|
267
267
|
specification_version: 4
|
268
268
|
summary: JPS Platform API Client with Full API Support
|
269
269
|
test_files: []
|