jpsclient 2.2.0 → 2.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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jpsclient/api/android_jks.rb +7 -70
  3. data/lib/jpsclient/api/app_level.rb +6 -60
  4. data/lib/jpsclient/api/app_resource.rb +7 -70
  5. data/lib/jpsclient/api/apple_account.rb +6 -60
  6. data/lib/jpsclient/api/apple_bundle_id.rb +1 -11
  7. data/lib/jpsclient/api/apple_cert.rb +1 -11
  8. data/lib/jpsclient/api/apple_profile.rb +1 -11
  9. data/lib/jpsclient/api/application.rb +12 -121
  10. data/lib/jpsclient/api/application_income.rb +2 -20
  11. data/lib/jpsclient/api/application_sales.rb +2 -20
  12. data/lib/jpsclient/api/application_version.rb +3 -30
  13. data/lib/jpsclient/api/archived_outdated/app_resource_version.rb +2 -20
  14. data/lib/jpsclient/api/archived_outdated/application_category.rb +5 -50
  15. data/lib/jpsclient/api/archived_outdated/application_design.rb +5 -50
  16. data/lib/jpsclient/api/archived_outdated/assets_category.rb +5 -50
  17. data/lib/jpsclient/api/archived_outdated/experience.rb +6 -60
  18. data/lib/jpsclient/api/archived_outdated/experience_category.rb +4 -40
  19. data/lib/jpsclient/api/archived_outdated/icon_and_snapshot.rb +2 -20
  20. data/lib/jpsclient/api/archived_outdated/publisher_category.rb +6 -60
  21. data/lib/jpsclient/api/archived_outdated/publisher_group_category.rb +5 -50
  22. data/lib/jpsclient/api/archived_outdated/requirements_category.rb +4 -40
  23. data/lib/jpsclient/api/archived_outdated/resource_category.rb +5 -50
  24. data/lib/jpsclient/api/archived_outdated/sketch_category.rb +4 -40
  25. data/lib/jpsclient/api/archived_outdated/survey_category.rb +4 -40
  26. data/lib/jpsclient/api/archived_outdated/tool_category.rb +5 -50
  27. data/lib/jpsclient/api/bug.rb +6 -60
  28. data/lib/jpsclient/api/category.rb +6 -60
  29. data/lib/jpsclient/api/cert.rb +1 -12
  30. data/lib/jpsclient/api/collect.rb +2 -20
  31. data/lib/jpsclient/api/collection.rb +7 -70
  32. data/lib/jpsclient/api/commit_log.rb +5 -52
  33. data/lib/jpsclient/api/creative.rb +2 -20
  34. data/lib/jpsclient/api/custom_application.rb +10 -100
  35. data/lib/jpsclient/api/custom_application_web.rb +2 -20
  36. data/lib/jpsclient/api/design.rb +5 -50
  37. data/lib/jpsclient/api/document_text.rb +1 -10
  38. data/lib/jpsclient/api/fgui_export.rb +2 -20
  39. data/lib/jpsclient/api/file.rb +4 -41
  40. data/lib/jpsclient/api/game_assets.rb +6 -60
  41. data/lib/jpsclient/api/healthy.rb +1 -10
  42. data/lib/jpsclient/api/idea.rb +5 -50
  43. data/lib/jpsclient/api/image_search.rb +2 -20
  44. data/lib/jpsclient/api/js_sdk.rb +1 -10
  45. data/lib/jpsclient/api/lark_bitable.rb +1 -10
  46. data/lib/jpsclient/api/lark_card_message.rb +1 -10
  47. data/lib/jpsclient/api/lark_chat_group.rb +1 -10
  48. data/lib/jpsclient/api/lark_comment.rb +5 -50
  49. data/lib/jpsclient/api/lark_department.rb +1 -10
  50. data/lib/jpsclient/api/lark_file.rb +1 -10
  51. data/lib/jpsclient/api/lark_leave_approval.rb +1 -10
  52. data/lib/jpsclient/api/lark_message.rb +1 -10
  53. data/lib/jpsclient/api/lark_task.rb +6 -60
  54. data/lib/jpsclient/api/lark_task_list.rb +5 -50
  55. data/lib/jpsclient/api/lark_task_section.rb +3 -30
  56. data/lib/jpsclient/api/lark_user.rb +1 -10
  57. data/lib/jpsclient/api/lark_wiki_node.rb +1 -10
  58. data/lib/jpsclient/api/lark_wiki_space.rb +1 -10
  59. data/lib/jpsclient/api/lazy_client.rb +39 -39
  60. data/lib/jpsclient/api/login.rb +4 -40
  61. data/lib/jpsclient/api/m3u8.rb +1 -10
  62. data/lib/jpsclient/api/menu.rb +6 -60
  63. data/lib/jpsclient/api/modular_client.rb +38 -38
  64. data/lib/jpsclient/api/nuget.rb +1 -10
  65. data/lib/jpsclient/api/permission.rb +5 -50
  66. data/lib/jpsclient/api/project.rb +2 -22
  67. data/lib/jpsclient/api/project_package.rb +9 -121
  68. data/lib/jpsclient/api/publisher.rb +7 -70
  69. data/lib/jpsclient/api/publisher_group.rb +5 -50
  70. data/lib/jpsclient/api/requirements.rb +6 -60
  71. data/lib/jpsclient/api/role.rb +7 -70
  72. data/lib/jpsclient/api/simple_search.rb +7 -70
  73. data/lib/jpsclient/api/sketch.rb +3 -30
  74. data/lib/jpsclient/api/sov.rb +1 -10
  75. data/lib/jpsclient/api/statistics.rb +1 -10
  76. data/lib/jpsclient/api/store.rb +1 -10
  77. data/lib/jpsclient/api/survey.rb +6 -60
  78. data/lib/jpsclient/api/tag.rb +6 -60
  79. data/lib/jpsclient/api/template.rb +5 -50
  80. data/lib/jpsclient/api/tool.rb +5 -50
  81. data/lib/jpsclient/api/trending.rb +1 -10
  82. data/lib/jpsclient/api/ud_id.rb +5 -50
  83. data/lib/jpsclient/api/user.rb +4 -40
  84. data/lib/jpsclient/api/util.rb +1 -10
  85. data/lib/jpsclient/api/video_cover.rb +1 -10
  86. data/lib/jpsclient/api/webhook.rb +5 -50
  87. data/lib/jpsclient/api/workflow.rb +5 -50
  88. data/lib/jpsclient/auth/auth.rb +21 -31
  89. data/lib/jpsclient/auth/token.rb +49 -95
  90. data/lib/jpsclient/base/client.rb +43 -38
  91. data/lib/jpsclient/http/http_client.rb +18 -2
  92. data/lib/jpsclient/version.rb +1 -1
  93. metadata +15 -1
@@ -15,16 +15,7 @@ module JPSClient
15
15
  path = config["url"]
16
16
  path = path.gsub("{categoryId}", categoryId.to_s)
17
17
 
18
- response = @http_client.put(path, body: params)
19
- result = JPSClient::Response.new(response)
20
-
21
- if result.need_login?
22
- do_login(force_login: true)
23
- response = @http_client.put(path, body: params)
24
- result = JPSClient::Response.new(response)
25
- end
26
-
27
- return result.to_h
18
+ return request_with_auth(:put, path, body: params)
28
19
  end
29
20
 
30
21
  # Create Survey Category
@@ -37,16 +28,7 @@ module JPSClient
37
28
 
38
29
  path = config["url"]
39
30
 
40
- response = @http_client.post(path, body: params)
41
- result = JPSClient::Response.new(response)
42
-
43
- if result.need_login?
44
- do_login(force_login: true)
45
- response = @http_client.post(path, body: params)
46
- result = JPSClient::Response.new(response)
47
- end
48
-
49
- return result.to_h
31
+ return request_with_auth(:post, path, body: params)
50
32
  end
51
33
 
52
34
  # Create Weights
@@ -59,16 +41,7 @@ module JPSClient
59
41
 
60
42
  path = config["url"]
61
43
 
62
- response = @http_client.post(path, body: params)
63
- result = JPSClient::Response.new(response)
64
-
65
- if result.need_login?
66
- do_login(force_login: true)
67
- response = @http_client.post(path, body: params)
68
- result = JPSClient::Response.new(response)
69
- end
70
-
71
- return result.to_h
44
+ return request_with_auth(:post, path, body: params)
72
45
  end
73
46
 
74
47
  # Create Survey Categories
@@ -81,16 +54,7 @@ module JPSClient
81
54
 
82
55
  path = config["url"]
83
56
 
84
- response = @http_client.post(path, body: params)
85
- result = JPSClient::Response.new(response)
86
-
87
- if result.need_login?
88
- do_login(force_login: true)
89
- response = @http_client.post(path, body: params)
90
- result = JPSClient::Response.new(response)
91
- end
92
-
93
- return result.to_h
57
+ return request_with_auth(:post, path, body: params)
94
58
  end
95
59
  end
96
60
  end
@@ -15,16 +15,7 @@ module JPSClient
15
15
  path = config["url"]
16
16
  path = path.gsub("{categoryId}", categoryId.to_s)
17
17
 
18
- response = @http_client.put(path, body: params)
19
- result = JPSClient::Response.new(response)
20
-
21
- if result.need_login?
22
- do_login(force_login: true)
23
- response = @http_client.put(path, body: params)
24
- result = JPSClient::Response.new(response)
25
- end
26
-
27
- return result.to_h
18
+ return request_with_auth(:put, path, body: params)
28
19
  end
29
20
 
30
21
  # Delete Tool Category
@@ -38,16 +29,7 @@ module JPSClient
38
29
  path = config["url"]
39
30
  path = path.gsub("{categoryId}", categoryId.to_s)
40
31
 
41
- response = @http_client.delete(path)
42
- result = JPSClient::Response.new(response)
43
-
44
- if result.need_login?
45
- do_login(force_login: true)
46
- response = @http_client.delete(path)
47
- result = JPSClient::Response.new(response)
48
- end
49
-
50
- return result.to_h
32
+ return request_with_auth(:delete, path)
51
33
  end
52
34
 
53
35
  # Create Tool Category
@@ -60,16 +42,7 @@ module JPSClient
60
42
 
61
43
  path = config["url"]
62
44
 
63
- response = @http_client.post(path, body: params)
64
- result = JPSClient::Response.new(response)
65
-
66
- if result.need_login?
67
- do_login(force_login: true)
68
- response = @http_client.post(path, body: params)
69
- result = JPSClient::Response.new(response)
70
- end
71
-
72
- return result.to_h
45
+ return request_with_auth(:post, path, body: params)
73
46
  end
74
47
 
75
48
  # Create Weights
@@ -82,16 +55,7 @@ module JPSClient
82
55
 
83
56
  path = config["url"]
84
57
 
85
- response = @http_client.post(path, body: params)
86
- result = JPSClient::Response.new(response)
87
-
88
- if result.need_login?
89
- do_login(force_login: true)
90
- response = @http_client.post(path, body: params)
91
- result = JPSClient::Response.new(response)
92
- end
93
-
94
- return result.to_h
58
+ return request_with_auth(:post, path, body: params)
95
59
  end
96
60
 
97
61
  # Get Tool Categories
@@ -104,16 +68,7 @@ module JPSClient
104
68
 
105
69
  path = config["url"]
106
70
 
107
- response = @http_client.get(path, params: params)
108
- result = JPSClient::Response.new(response)
109
-
110
- if result.need_login?
111
- do_login(force_login: true)
112
- response = @http_client.get(path, params: params)
113
- result = JPSClient::Response.new(response)
114
- end
115
-
116
- return result.to_h
71
+ return request_with_auth(:get, path, params: params)
117
72
  end
118
73
  end
119
74
  end
@@ -14,16 +14,7 @@ module JPSClient
14
14
 
15
15
  path = config["url"]
16
16
 
17
- response = @http_client.post(path, body: params)
18
- result = JPSClient::Response.new(response)
19
-
20
- if result.need_login?
21
- do_login(force_login: true)
22
- response = @http_client.post(path, body: params)
23
- result = JPSClient::Response.new(response)
24
- end
25
-
26
- return result.to_h
17
+ return request_with_auth(:post, path, body: params)
27
18
  end
28
19
 
29
20
  # Get List
@@ -36,16 +27,7 @@ module JPSClient
36
27
 
37
28
  path = config["url"]
38
29
 
39
- response = @http_client.post(path, body: params)
40
- result = JPSClient::Response.new(response)
41
-
42
- if result.need_login?
43
- do_login(force_login: true)
44
- response = @http_client.post(path, body: params)
45
- result = JPSClient::Response.new(response)
46
- end
47
-
48
- return result.to_h
30
+ return request_with_auth(:post, path, body: params)
49
31
  end
50
32
 
51
33
  # Create Delete
@@ -58,16 +40,7 @@ module JPSClient
58
40
 
59
41
  path = config["url"]
60
42
 
61
- response = @http_client.post(path, body: params)
62
- result = JPSClient::Response.new(response)
63
-
64
- if result.need_login?
65
- do_login(force_login: true)
66
- response = @http_client.post(path, body: params)
67
- result = JPSClient::Response.new(response)
68
- end
69
-
70
- return result.to_h
43
+ return request_with_auth(:post, path, body: params)
71
44
  end
72
45
 
73
46
  # Create Create
@@ -80,16 +53,7 @@ module JPSClient
80
53
 
81
54
  path = config["url"]
82
55
 
83
- response = @http_client.post(path, body: params)
84
- result = JPSClient::Response.new(response)
85
-
86
- if result.need_login?
87
- do_login(force_login: true)
88
- response = @http_client.post(path, body: params)
89
- result = JPSClient::Response.new(response)
90
- end
91
-
92
- return result.to_h
56
+ return request_with_auth(:post, path, body: params)
93
57
  end
94
58
 
95
59
  # Get Fields
@@ -102,16 +66,7 @@ module JPSClient
102
66
 
103
67
  path = config["url"]
104
68
 
105
- response = @http_client.get(path, params: params)
106
- result = JPSClient::Response.new(response)
107
-
108
- if result.need_login?
109
- do_login(force_login: true)
110
- response = @http_client.get(path, params: params)
111
- result = JPSClient::Response.new(response)
112
- end
113
-
114
- return result.to_h
69
+ return request_with_auth(:get, path, params: params)
115
70
  end
116
71
 
117
72
  # Get Detail
@@ -124,16 +79,7 @@ module JPSClient
124
79
 
125
80
  path = config["url"]
126
81
 
127
- response = @http_client.get(path, params: params)
128
- result = JPSClient::Response.new(response)
129
-
130
- if result.need_login?
131
- do_login(force_login: true)
132
- response = @http_client.get(path, params: params)
133
- result = JPSClient::Response.new(response)
134
- end
135
-
136
- return result.to_h
82
+ return request_with_auth(:get, path, params: params)
137
83
  end
138
84
  end
139
85
  end
@@ -16,16 +16,7 @@ module JPSClient
16
16
 
17
17
  path = config["url"]
18
18
 
19
- response = @http_client.get(path, params: params)
20
- result = JPSClient::Response.new(response)
21
-
22
- if result.need_login?
23
- do_login(force_login: true)
24
- response = @http_client.get(path, params: params)
25
- result = JPSClient::Response.new(response)
26
- end
27
-
28
- return result.to_h
19
+ return request_with_auth(:get, path, params: params)
29
20
  end
30
21
 
31
22
  # 获取分类树形结构
@@ -40,16 +31,7 @@ module JPSClient
40
31
 
41
32
  path = config["url"]
42
33
 
43
- response = @http_client.get(path, params: params)
44
- result = JPSClient::Response.new(response)
45
-
46
- if result.need_login?
47
- do_login(force_login: true)
48
- response = @http_client.get(path, params: params)
49
- result = JPSClient::Response.new(response)
50
- end
51
-
52
- return result.to_h
34
+ return request_with_auth(:get, path, params: params)
53
35
  end
54
36
 
55
37
  # 创建分类
@@ -79,16 +61,7 @@ module JPSClient
79
61
 
80
62
  path = config["url"]
81
63
 
82
- response = @http_client.post(path, body: params)
83
- result = JPSClient::Response.new(response)
84
-
85
- if result.need_login?
86
- do_login(force_login: true)
87
- response = @http_client.post(path, body: params)
88
- result = JPSClient::Response.new(response)
89
- end
90
-
91
- return result.to_h
64
+ return request_with_auth(:post, path, body: params)
92
65
  end
93
66
 
94
67
  # 更新分类
@@ -110,16 +83,7 @@ module JPSClient
110
83
 
111
84
  path = config["url"]
112
85
 
113
- response = @http_client.post(path, body: params)
114
- result = JPSClient::Response.new(response)
115
-
116
- if result.need_login?
117
- do_login(force_login: true)
118
- response = @http_client.post(path, body: params)
119
- result = JPSClient::Response.new(response)
120
- end
121
-
122
- return result.to_h
86
+ return request_with_auth(:post, path, body: params)
123
87
  end
124
88
 
125
89
  # 删除分类
@@ -135,16 +99,7 @@ module JPSClient
135
99
  # POST请求,ID作为body参数
136
100
  params = { id: id }
137
101
 
138
- response = @http_client.post(path, body: params)
139
- result = JPSClient::Response.new(response)
140
-
141
- if result.need_login?
142
- do_login(force_login: true)
143
- response = @http_client.post(path, body: params)
144
- result = JPSClient::Response.new(response)
145
- end
146
-
147
- return result.to_h
102
+ return request_with_auth(:post, path, body: params)
148
103
  end
149
104
 
150
105
  # 分类排序
@@ -175,16 +130,7 @@ module JPSClient
175
130
  path = config["url"]
176
131
  params = { items: items }
177
132
 
178
- response = @http_client.post(path, body: params)
179
- result = JPSClient::Response.new(response)
180
-
181
- if result.need_login?
182
- do_login(force_login: true)
183
- response = @http_client.post(path, body: params)
184
- result = JPSClient::Response.new(response)
185
- end
186
-
187
- return result.to_h
133
+ return request_with_auth(:post, path, body: params)
188
134
  end
189
135
 
190
136
  # 按类型获取分类列表(便捷方法)
@@ -11,18 +11,7 @@ module JPSClient
11
11
 
12
12
  path = config["url"]
13
13
 
14
- response = @http_client.get(path)
15
- result = JPSClient::Response.new(response)
16
-
17
- # 处理 401 错误,自动重新登录
18
- if result.need_login?
19
- do_login(force_login: true)
20
- # 重试请求
21
- response = @http_client.get(path)
22
- result = JPSClient::Response.new(response)
23
- end
24
-
25
- return result.to_h
14
+ return request_with_auth(:get, path)
26
15
  end
27
16
 
28
17
  end
@@ -14,16 +14,7 @@ module JPSClient
14
14
 
15
15
  path = config["url"]
16
16
 
17
- response = @http_client.post(path, body: params)
18
- result = JPSClient::Response.new(response)
19
-
20
- if result.need_login?
21
- do_login(force_login: true)
22
- response = @http_client.post(path, body: params)
23
- result = JPSClient::Response.new(response)
24
- end
25
-
26
- return result.to_h
17
+ return request_with_auth(:post, path, body: params)
27
18
  end
28
19
 
29
20
  # Delete Collect
@@ -36,16 +27,7 @@ module JPSClient
36
27
 
37
28
  path = config["url"]
38
29
 
39
- response = @http_client.delete(path)
40
- result = JPSClient::Response.new(response)
41
-
42
- if result.need_login?
43
- do_login(force_login: true)
44
- response = @http_client.delete(path)
45
- result = JPSClient::Response.new(response)
46
- end
47
-
48
- return result.to_h
30
+ return request_with_auth(:delete, path)
49
31
  end
50
32
  end
51
33
  end
@@ -14,16 +14,7 @@ module JPSClient
14
14
 
15
15
  path = config["url"]
16
16
 
17
- response = @http_client.post(path, body: params)
18
- result = JPSClient::Response.new(response)
19
-
20
- if result.need_login?
21
- do_login(force_login: true)
22
- response = @http_client.post(path, body: params)
23
- result = JPSClient::Response.new(response)
24
- end
25
-
26
- return result.to_h
17
+ return request_with_auth(:post, path, body: params)
27
18
  end
28
19
 
29
20
  # Create Update
@@ -36,16 +27,7 @@ module JPSClient
36
27
 
37
28
  path = config["url"]
38
29
 
39
- response = @http_client.post(path, body: params)
40
- result = JPSClient::Response.new(response)
41
-
42
- if result.need_login?
43
- do_login(force_login: true)
44
- response = @http_client.post(path, body: params)
45
- result = JPSClient::Response.new(response)
46
- end
47
-
48
- return result.to_h
30
+ return request_with_auth(:post, path, body: params)
49
31
  end
50
32
 
51
33
  # Get List
@@ -58,16 +40,7 @@ module JPSClient
58
40
 
59
41
  path = config["url"]
60
42
 
61
- response = @http_client.post(path, body: params)
62
- result = JPSClient::Response.new(response)
63
-
64
- if result.need_login?
65
- do_login(force_login: true)
66
- response = @http_client.post(path, body: params)
67
- result = JPSClient::Response.new(response)
68
- end
69
-
70
- return result.to_h
43
+ return request_with_auth(:post, path, body: params)
71
44
  end
72
45
 
73
46
  # Create Detail
@@ -80,16 +53,7 @@ module JPSClient
80
53
 
81
54
  path = config["url"]
82
55
 
83
- response = @http_client.post(path, body: params)
84
- result = JPSClient::Response.new(response)
85
-
86
- if result.need_login?
87
- do_login(force_login: true)
88
- response = @http_client.post(path, body: params)
89
- result = JPSClient::Response.new(response)
90
- end
91
-
92
- return result.to_h
56
+ return request_with_auth(:post, path, body: params)
93
57
  end
94
58
 
95
59
  # Create Delete
@@ -102,16 +66,7 @@ module JPSClient
102
66
 
103
67
  path = config["url"]
104
68
 
105
- response = @http_client.post(path, body: params)
106
- result = JPSClient::Response.new(response)
107
-
108
- if result.need_login?
109
- do_login(force_login: true)
110
- response = @http_client.post(path, body: params)
111
- result = JPSClient::Response.new(response)
112
- end
113
-
114
- return result.to_h
69
+ return request_with_auth(:post, path, body: params)
115
70
  end
116
71
 
117
72
  # Create Create
@@ -124,16 +79,7 @@ module JPSClient
124
79
 
125
80
  path = config["url"]
126
81
 
127
- response = @http_client.post(path, body: params)
128
- result = JPSClient::Response.new(response)
129
-
130
- if result.need_login?
131
- do_login(force_login: true)
132
- response = @http_client.post(path, body: params)
133
- result = JPSClient::Response.new(response)
134
- end
135
-
136
- return result.to_h
82
+ return request_with_auth(:post, path, body: params)
137
83
  end
138
84
 
139
85
  # Create Bind
@@ -146,16 +92,7 @@ module JPSClient
146
92
 
147
93
  path = config["url"]
148
94
 
149
- response = @http_client.post(path, body: params)
150
- result = JPSClient::Response.new(response)
151
-
152
- if result.need_login?
153
- do_login(force_login: true)
154
- response = @http_client.post(path, body: params)
155
- result = JPSClient::Response.new(response)
156
- end
157
-
158
- return result.to_h
95
+ return request_with_auth(:post, path, body: params)
159
96
  end
160
97
  end
161
98
  end
@@ -24,16 +24,7 @@ module JPSClient
24
24
  body_params[:description] = params[:description] if params.key?(:description)
25
25
  body_params[:fileUrls] = params[:fileUrls] if params[:fileUrls]
26
26
 
27
- response = @http_client.post(path, body: body_params)
28
- result = JPSClient::Response.new(response)
29
-
30
- if result.need_login?
31
- do_login(force_login: true)
32
- response = @http_client.post(path, body: body_params)
33
- result = JPSClient::Response.new(response)
34
- end
35
-
36
- return result.to_h
27
+ return request_with_auth(:post, path, body: body_params)
37
28
  end
38
29
 
39
30
  # 发送提交记录消息通知
@@ -68,17 +59,7 @@ module JPSClient
68
59
  body_params[:endTimestamp] = params[:endTimestamp] if params[:endTimestamp]
69
60
  body_params[:indexNo] = params[:indexNo] if params[:indexNo]
70
61
 
71
- response = @http_client.post(path, body: body_params)
72
- result = JPSClient::Response.new(response)
73
-
74
- # 处理 401 错误,自动重新登录
75
- if result.need_login?
76
- do_login(force_login: true)
77
- response = @http_client.post(path, body: body_params)
78
- result = JPSClient::Response.new(response)
79
- end
80
-
81
- return result.to_h
62
+ return request_with_auth(:post, path, body: body_params)
82
63
  end
83
64
 
84
65
  # 获取提交记录简要信息
@@ -94,16 +75,7 @@ module JPSClient
94
75
  commitId: commitId
95
76
  }
96
77
 
97
- response = @http_client.get(path, params: get_params)
98
- result = JPSClient::Response.new(response)
99
-
100
- if result.need_login?
101
- do_login(force_login: true)
102
- response = @http_client.get(path, params: get_params)
103
- result = JPSClient::Response.new(response)
104
- end
105
-
106
- return result.to_h
78
+ return request_with_auth(:get, path, params: get_params)
107
79
  end
108
80
 
109
81
  # 预览提交记录
@@ -125,16 +97,7 @@ module JPSClient
125
97
 
126
98
  get_params[:onlyCliff] = params[:onlyCliff] if params.key?(:onlyCliff)
127
99
 
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
100
+ return request_with_auth(:get, path, params: get_params)
138
101
  end
139
102
 
140
103
  # 获取提交记录列表
@@ -175,17 +138,7 @@ module JPSClient
175
138
  get_params[:startTimestamp] = params[:startTimestamp] if params[:startTimestamp]
176
139
  get_params[:endTimestamp] = params[:endTimestamp] if params[:endTimestamp]
177
140
 
178
- response = @http_client.get(path, params: get_params)
179
- result = JPSClient::Response.new(response)
180
-
181
- # 处理 401 错误
182
- if result.need_login?
183
- do_login(force_login: true)
184
- response = @http_client.get(path, params: get_params)
185
- result = JPSClient::Response.new(response)
186
- end
187
-
188
- return result.to_h
141
+ return request_with_auth(:get, path, params: get_params)
189
142
  end
190
143
 
191
144
  end
@@ -14,16 +14,7 @@ module JPSClient
14
14
 
15
15
  path = config["url"]
16
16
 
17
- response = @http_client.post(path, body: params)
18
- result = JPSClient::Response.new(response)
19
-
20
- if result.need_login?
21
- do_login(force_login: true)
22
- response = @http_client.post(path, body: params)
23
- result = JPSClient::Response.new(response)
24
- end
25
-
26
- return result.to_h
17
+ return request_with_auth(:post, path, body: params)
27
18
  end
28
19
 
29
20
  # Get Top Publishers
@@ -36,16 +27,7 @@ module JPSClient
36
27
 
37
28
  path = config["url"]
38
29
 
39
- response = @http_client.get(path, params: params)
40
- result = JPSClient::Response.new(response)
41
-
42
- if result.need_login?
43
- do_login(force_login: true)
44
- response = @http_client.get(path, params: params)
45
- result = JPSClient::Response.new(response)
46
- end
47
-
48
- return result.to_h
30
+ return request_with_auth(:get, path, params: params)
49
31
  end
50
32
  end
51
33
  end