jpsclient 2.0.4 → 2.0.6

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: 9f63634bc5ba1fbebefa6a5e9a25ab1d9deec1aff9f9af60c0bf198da5632e66
4
- data.tar.gz: 0ddf4fe34aaf7cafedf37b2e10a5c559d9066973845859aed72f107e0d5f8edb
3
+ metadata.gz: ad5bd859a9d9ac069a226f185690a9b913e05d0f069f0110a1037845229be10b
4
+ data.tar.gz: 889c49e9c9ef77845eef1aaf2b0514d7ad23608493912757ecca98e678ecf136
5
5
  SHA512:
6
- metadata.gz: d5f01fe231fc63335703a762349a746eec57cf412446bc38dd9c2d456514137f5908c21a45f069b291c8a6575bd38de24293da6e30a753e761a40842168e6920
7
- data.tar.gz: b21b6c17c5ae707da4b540b75751753fddf70555e3d24ab7d51499424262e2bdc6b4a10c60d45700646b6200436b15e3d93470e59246769ae6ebc15fb10514a5
6
+ metadata.gz: 394b3e8b9052b2eb58681dc890b5c495e134a331d3dc1b3d6c255a76e4d801836b2f179d9989968d62294776872cf7367752264702f8a8fd545871fb3c2b5b2f
7
+ data.tar.gz: 91458dc40febc7035047212ba3843a1e32618bca862e6d0fe58770436ed7bad4de35ea791314150b42ad7b3c96cf6a4b9e3d07d9123a01bd3e556fc378fe3d46
@@ -0,0 +1,203 @@
1
+ module JPSClient
2
+ module API
3
+ # Android JKS 证书相关 API
4
+ # 处理 /api/android_jks/* 路径的所有接口
5
+ #
6
+ # 支持的功能:
7
+ # - 创建 JKS 证书(异步)
8
+ # - 更新 JKS 证书信息
9
+ # - 删除 JKS 证书
10
+ # - 获取 JKS 证书列表
11
+ # - 获取 JKS 证书详情
12
+ # - APK 重签名(异步)
13
+ module AndroidJks
14
+
15
+ # 创建 Android JKS 证书(异步接口)
16
+ #
17
+ # @param alias_name [String] 证书别名(必填)
18
+ # @param store_password [String] keystore 密码,为空则自动生成
19
+ # @param key_password [String] key 密码,为空则与 store_password 一致
20
+ # @param validity [Integer] 有效期(天),默认 36500
21
+ # @param distinguished_name [Hash] DN 信息,如 {CN: "xxx", O: "xxx"}
22
+ # @param bundle_id [String] 包名
23
+ # @param google_account [String] Google 开发者账号
24
+ # @param project_id [String] 关联项目 ID
25
+ # @param remark [String] 备注
26
+ # @return [Hash] API 响应(异步任务)
27
+ def create_android_jks(alias_name:, store_password: nil, key_password: nil, validity: nil,
28
+ distinguished_name: nil, bundle_id: nil, google_account: nil,
29
+ project_id: nil, remark: nil)
30
+ config = @request_config && @request_config["android_jks_create"]
31
+ raise JPSClient::ExceptionError, "Missing config for android_jks_create" unless config && config["url"]
32
+ path = config["url"]
33
+
34
+ body_params = { aliasName: alias_name }
35
+ body_params[:storePassword] = store_password if store_password
36
+ body_params[:keyPassword] = key_password if key_password
37
+ body_params[:validity] = validity if validity
38
+ body_params[:distinguishedName] = distinguished_name if distinguished_name
39
+ body_params[:bundleId] = bundle_id if bundle_id
40
+ body_params[:googleAccount] = google_account if google_account
41
+ body_params[:projectId] = project_id if project_id
42
+ body_params[:remark] = remark if remark
43
+
44
+ response = @http_client.post(path, body: body_params)
45
+ result = JPSClient::Response.new(response)
46
+
47
+ if result.need_login?
48
+ do_login(force_login: true)
49
+ response = @http_client.post(path, body: body_params)
50
+ result = JPSClient::Response.new(response)
51
+ end
52
+
53
+ return result.to_h
54
+ end
55
+
56
+ # 更新 Android JKS 证书信息
57
+ #
58
+ # @param id [String] JKS ID(必填)
59
+ # @param bundle_id [String] 包名
60
+ # @param google_account [String] Google 开发者账号
61
+ # @param project_id [String] 关联项目 ID
62
+ # @param remark [String] 备注
63
+ # @return [Hash] API 响应
64
+ def update_android_jks(id:, bundle_id: nil, google_account: nil, project_id: nil, remark: nil)
65
+ config = @request_config && @request_config["android_jks_update"]
66
+ raise JPSClient::ExceptionError, "Missing config for android_jks_update" unless config && config["url"]
67
+ path = config["url"]
68
+
69
+ body_params = { id: id }
70
+ body_params[:bundleId] = bundle_id if bundle_id
71
+ body_params[:googleAccount] = google_account if google_account
72
+ body_params[:projectId] = project_id if project_id
73
+ body_params[:remark] = remark if remark
74
+
75
+ response = @http_client.post(path, body: body_params)
76
+ result = JPSClient::Response.new(response)
77
+
78
+ if result.need_login?
79
+ do_login(force_login: true)
80
+ response = @http_client.post(path, body: body_params)
81
+ result = JPSClient::Response.new(response)
82
+ end
83
+
84
+ return result.to_h
85
+ end
86
+
87
+ # 删除 Android JKS 证书
88
+ #
89
+ # @param id [String] JKS ID(必填)
90
+ # @return [Hash] API 响应
91
+ def delete_android_jks(id:)
92
+ config = @request_config && @request_config["android_jks_delete"]
93
+ raise JPSClient::ExceptionError, "Missing config for android_jks_delete" unless config && config["url"]
94
+ path = config["url"]
95
+
96
+ body_params = { id: id }
97
+
98
+ response = @http_client.post(path, body: body_params)
99
+ result = JPSClient::Response.new(response)
100
+
101
+ if result.need_login?
102
+ do_login(force_login: true)
103
+ response = @http_client.post(path, body: body_params)
104
+ result = JPSClient::Response.new(response)
105
+ end
106
+
107
+ return result.to_h
108
+ end
109
+
110
+ # 获取 Android JKS 证书列表
111
+ #
112
+ # @param page_no [Integer] 当前页数(必填)
113
+ # @param page_size [Integer] 每页记录数(必填)
114
+ # @param alias_name [String] 证书别名(可选)
115
+ # @param google_account [String] Google 开发者账号(可选)
116
+ # @param project_id [String] 关联项目 ID(可选)
117
+ # @return [Hash] API 响应,data 包含 list 数组和 total 总数
118
+ def get_android_jks_list(page_no: 1, page_size: 20, alias_name: nil, google_account: nil, project_id: nil)
119
+ config = @request_config && @request_config["android_jks_list"]
120
+ raise JPSClient::ExceptionError, "Missing config for android_jks_list" unless config && config["url"]
121
+ path = config["url"]
122
+
123
+ get_params = { pageNo: page_no, pageSize: page_size }
124
+ get_params[:aliasName] = alias_name if alias_name
125
+ get_params[:googleAccount] = google_account if google_account
126
+ get_params[:projectId] = project_id if project_id
127
+
128
+ response = @http_client.get(path, params: get_params)
129
+ result = JPSClient::Response.new(response)
130
+
131
+ if result.need_login?
132
+ do_login(force_login: true)
133
+ response = @http_client.get(path, params: get_params)
134
+ result = JPSClient::Response.new(response)
135
+ end
136
+
137
+ return result.to_h
138
+ end
139
+
140
+ # 获取 Android JKS 证书详情
141
+ #
142
+ # @param alias_name [String] 证书别名(必填)
143
+ # @return [Hash] API 响应,data 包含 id、jksFileUrl、storePassword、keyPassword
144
+ def get_android_jks_detail(alias_name:)
145
+ config = @request_config && @request_config["android_jks_detail"]
146
+ raise JPSClient::ExceptionError, "Missing config for android_jks_detail" unless config && config["url"]
147
+ path = config["url"]
148
+
149
+ get_params = { aliasName: alias_name }
150
+
151
+ response = @http_client.get(path, params: get_params)
152
+ result = JPSClient::Response.new(response)
153
+
154
+ if result.need_login?
155
+ do_login(force_login: true)
156
+ response = @http_client.get(path, params: get_params)
157
+ result = JPSClient::Response.new(response)
158
+ end
159
+
160
+ return result.to_h
161
+ end
162
+
163
+ # APK 重签名(异步接口)
164
+ #
165
+ # @param input_s3_key [String] 输入 APK 文件的 S3 Key(必填)
166
+ # @param output_s3_key [String] 输出 APK 文件的 S3 Key(必填)
167
+ # @param new_package [String] 新的包名(必填)
168
+ # @param jks_id [String] JKS 证书 ID(必填)
169
+ # @param s3_bucket [String] S3 Bucket,默认 pgy-resource-new
170
+ # @param use_aapt2 [Boolean] 是否使用 aapt2,默认 true
171
+ # @param skip_verify [Boolean] 是否跳过签名验证,默认 false
172
+ # @return [Hash] API 响应(异步任务)
173
+ def rewrite_apk(input_s3_key:, output_s3_key:, new_package:, jks_id:,
174
+ s3_bucket: nil, use_aapt2: nil, skip_verify: nil)
175
+ config = @request_config && @request_config["android_jks_rewrite_apk"]
176
+ raise JPSClient::ExceptionError, "Missing config for android_jks_rewrite_apk" unless config && config["url"]
177
+ path = config["url"]
178
+
179
+ body_params = {
180
+ inputS3Key: input_s3_key,
181
+ outputS3Key: output_s3_key,
182
+ newPackage: new_package,
183
+ jksId: jks_id
184
+ }
185
+ body_params[:s3Bucket] = s3_bucket if s3_bucket
186
+ body_params[:useAapt2] = use_aapt2 unless use_aapt2.nil?
187
+ body_params[:skipVerify] = skip_verify unless skip_verify.nil?
188
+
189
+ response = @http_client.post(path, body: body_params)
190
+ result = JPSClient::Response.new(response)
191
+
192
+ if result.need_login?
193
+ do_login(force_login: true)
194
+ response = @http_client.post(path, body: body_params)
195
+ result = JPSClient::Response.new(response)
196
+ end
197
+
198
+ return result.to_h
199
+ end
200
+
201
+ end
202
+ end
203
+ end
@@ -9,6 +9,7 @@ require 'jpsclient/auth/token'
9
9
  require 'jpsclient/utils/logger'
10
10
 
11
11
  # 加载 API 模块
12
+ require 'jpsclient/api/android_jks'
12
13
  require 'jpsclient/api/app_level'
13
14
  require 'jpsclient/api/app_resource'
14
15
  # require 'jpsclient/api/app_resource_version' # 已移除 - API不存在
@@ -98,6 +99,7 @@ module JPSClient
98
99
 
99
100
  class Client
100
101
  # 引入各个 API 模块
102
+ include API::AndroidJks
101
103
  include API::AppLevel
102
104
  include API::AppResource
103
105
  # include API::AppResourceVersion # 已移除 - API不存在
@@ -1,3 +1,3 @@
1
1
  module JPSClient
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.6"
3
3
  end
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: 2.0.4
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-03-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday
@@ -161,6 +161,7 @@ files:
161
161
  - LICENSE
162
162
  - bin/jpsclient
163
163
  - lib/jpsclient.rb
164
+ - lib/jpsclient/api/android_jks.rb
164
165
  - lib/jpsclient/api/app_level.rb
165
166
  - lib/jpsclient/api/app_resource.rb
166
167
  - lib/jpsclient/api/apple_account.rb
@@ -280,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
281
  - !ruby/object:Gem::Version
281
282
  version: '0'
282
283
  requirements: []
283
- rubygems_version: 4.0.3
284
+ rubygems_version: 3.6.3
284
285
  specification_version: 4
285
286
  summary: JPS Platform API Client with Full API Support
286
287
  test_files: []