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,17 +15,7 @@ module JPSClient
15
15
  # 构建路径,替换路径参数
16
16
  path = config["url"].gsub("{applicationId}", applicationId.to_s)
17
17
 
18
- response = @http_client.get(path)
19
- result = JPSClient::Response.new(response)
20
-
21
- # 处理 401 错误,自动重新登录
22
- if result.need_login?
23
- do_login(force_login: true)
24
- response = @http_client.get(path)
25
- result = JPSClient::Response.new(response)
26
- end
27
-
28
- return result.to_h
18
+ return request_with_auth(:get, path)
29
19
  end
30
20
 
31
21
  # 更新应用信息
@@ -39,16 +29,7 @@ module JPSClient
39
29
 
40
30
  path = config["url"].gsub("{applicationId}", applicationId.to_s)
41
31
 
42
- response = @http_client.put(path, body: params)
43
- result = JPSClient::Response.new(response)
44
-
45
- if result.need_login?
46
- do_login(force_login: true)
47
- response = @http_client.put(path, body: params)
48
- result = JPSClient::Response.new(response)
49
- end
50
-
51
- return result.to_h
32
+ return request_with_auth(:put, path, body: params)
52
33
  end
53
34
 
54
35
  # 删除应用
@@ -61,16 +42,7 @@ module JPSClient
61
42
 
62
43
  path = config["url"].gsub("{applicationId}", applicationId.to_s)
63
44
 
64
- response = @http_client.delete(path)
65
- result = JPSClient::Response.new(response)
66
-
67
- if result.need_login?
68
- do_login(force_login: true)
69
- response = @http_client.delete(path)
70
- result = JPSClient::Response.new(response)
71
- end
72
-
73
- return result.to_h
45
+ return request_with_auth(:delete, path)
74
46
  end
75
47
 
76
48
  # 刷新应用
@@ -83,16 +55,7 @@ module JPSClient
83
55
 
84
56
  path = config["url"].gsub("{applicationId}", applicationId.to_s)
85
57
 
86
- response = @http_client.put(path)
87
- result = JPSClient::Response.new(response)
88
-
89
- if result.need_login?
90
- do_login(force_login: true)
91
- response = @http_client.put(path)
92
- result = JPSClient::Response.new(response)
93
- end
94
-
95
- return result.to_h
58
+ return request_with_auth(:put, path)
96
59
  end
97
60
 
98
61
  # 获取分类下的应用列表
@@ -106,16 +69,7 @@ module JPSClient
106
69
 
107
70
  path = config["url"].gsub("{categoryIdStr}", categoryIdStr.to_s)
108
71
 
109
- response = @http_client.post(path, body: params)
110
- result = JPSClient::Response.new(response)
111
-
112
- if result.need_login?
113
- do_login(force_login: true)
114
- response = @http_client.post(path, body: params)
115
- result = JPSClient::Response.new(response)
116
- end
117
-
118
- return result.to_h
72
+ return request_with_auth(:post, path, body: params)
119
73
  end
120
74
 
121
75
  # 创建应用
@@ -127,16 +81,7 @@ module JPSClient
127
81
  raise JPSClient::ExceptionError, "Missing config for application_create" unless config && config["url"]
128
82
  path = config["url"]
129
83
 
130
- response = @http_client.post(path, body: params)
131
- result = JPSClient::Response.new(response)
132
-
133
- if result.need_login?
134
- do_login(force_login: true)
135
- response = @http_client.post(path, body: params)
136
- result = JPSClient::Response.new(response)
137
- end
138
-
139
- return result.to_h
84
+ return request_with_auth(:post, path, body: params)
140
85
  end
141
86
 
142
87
  # 更新应用权重
@@ -148,16 +93,7 @@ module JPSClient
148
93
  raise JPSClient::ExceptionError, "Missing config for application_weights" unless config && config["url"]
149
94
  path = config["url"]
150
95
 
151
- response = @http_client.post(path, body: params)
152
- result = JPSClient::Response.new(response)
153
-
154
- if result.need_login?
155
- do_login(force_login: true)
156
- response = @http_client.post(path, body: params)
157
- result = JPSClient::Response.new(response)
158
- end
159
-
160
- return result.to_h
96
+ return request_with_auth(:post, path, body: params)
161
97
  end
162
98
 
163
99
  # 获取应用排名
@@ -169,16 +105,7 @@ module JPSClient
169
105
  raise JPSClient::ExceptionError, "Missing config for application_rankings" unless config && config["url"]
170
106
  path = config["url"]
171
107
 
172
- response = @http_client.post(path, body: params)
173
- result = JPSClient::Response.new(response)
174
-
175
- if result.need_login?
176
- do_login(force_login: true)
177
- response = @http_client.post(path, body: params)
178
- result = JPSClient::Response.new(response)
179
- end
180
-
181
- return result.to_h
108
+ return request_with_auth(:post, path, body: params)
182
109
  end
183
110
 
184
111
  # 快速绑定应用
@@ -190,16 +117,7 @@ module JPSClient
190
117
  raise JPSClient::ExceptionError, "Missing config for application_fast_bind" unless config && config["url"]
191
118
  path = config["url"]
192
119
 
193
- response = @http_client.post(path, body: params)
194
- result = JPSClient::Response.new(response)
195
-
196
- if result.need_login?
197
- do_login(force_login: true)
198
- response = @http_client.post(path, body: params)
199
- result = JPSClient::Response.new(response)
200
- end
201
-
202
- return result.to_h
120
+ return request_with_auth(:post, path, body: params)
203
121
  end
204
122
 
205
123
  # 获取 Lark 任务应用列表
@@ -211,16 +129,7 @@ module JPSClient
211
129
  raise JPSClient::ExceptionError, "Missing config for lark_task_apps_list" unless config && config["url"]
212
130
  path = config["url"]
213
131
 
214
- response = @http_client.get(path, params: params)
215
- result = JPSClient::Response.new(response)
216
-
217
- if result.need_login?
218
- do_login(force_login: true)
219
- response = @http_client.get(path, params: params)
220
- result = JPSClient::Response.new(response)
221
- end
222
-
223
- return result.to_h
132
+ return request_with_auth(:get, path, params: params)
224
133
  end
225
134
 
226
135
  # 获取设计师列表
@@ -231,16 +140,7 @@ module JPSClient
231
140
  raise JPSClient::ExceptionError, "Missing config for designers_list" unless config && config["url"]
232
141
  path = config["url"]
233
142
 
234
- response = @http_client.get(path)
235
- result = JPSClient::Response.new(response)
236
-
237
- if result.need_login?
238
- do_login(force_login: true)
239
- response = @http_client.get(path)
240
- result = JPSClient::Response.new(response)
241
- end
242
-
243
- return result.to_h
143
+ return request_with_auth(:get, path)
244
144
  end
245
145
 
246
146
  # 获取应用商店分类
@@ -251,16 +151,7 @@ module JPSClient
251
151
  raise JPSClient::ExceptionError, "Missing config for appstore_categories" unless config && config["url"]
252
152
  path = config["url"]
253
153
 
254
- response = @http_client.get(path)
255
- result = JPSClient::Response.new(response)
256
-
257
- if result.need_login?
258
- do_login(force_login: true)
259
- response = @http_client.get(path)
260
- result = JPSClient::Response.new(response)
261
- end
262
-
263
- return result.to_h
154
+ return request_with_auth(:get, path)
264
155
  end
265
156
 
266
157
  end
@@ -15,16 +15,7 @@ module JPSClient
15
15
  path = config["url"]
16
16
  path = path.gsub("{applicationId}", applicationId.to_s)
17
17
 
18
- response = @http_client.get(path, params: params)
19
- result = JPSClient::Response.new(response)
20
-
21
- if result.need_login?
22
- do_login(force_login: true)
23
- response = @http_client.get(path, params: params)
24
- result = JPSClient::Response.new(response)
25
- end
26
-
27
- return result.to_h
18
+ return request_with_auth(:get, path, params: params)
28
19
  end
29
20
 
30
21
  # Create Income Download
@@ -38,16 +29,7 @@ module JPSClient
38
29
  path = config["url"]
39
30
  path = path.gsub("{applicationId}", applicationId.to_s)
40
31
 
41
- response = @http_client.post(path, body: params)
42
- result = JPSClient::Response.new(response)
43
-
44
- if result.need_login?
45
- do_login(force_login: true)
46
- response = @http_client.post(path, body: params)
47
- result = JPSClient::Response.new(response)
48
- end
49
-
50
- return result.to_h
32
+ return request_with_auth(:post, path, body: params)
51
33
  end
52
34
  end
53
35
  end
@@ -14,16 +14,7 @@ module JPSClient
14
14
 
15
15
  path = config["url"]
16
16
 
17
- response = @http_client.get(path, params: params)
18
- result = JPSClient::Response.new(response)
19
-
20
- if result.need_login?
21
- do_login(force_login: true)
22
- response = @http_client.get(path, params: params)
23
- result = JPSClient::Response.new(response)
24
- end
25
-
26
- return result.to_h
17
+ return request_with_auth(:get, path, params: params)
27
18
  end
28
19
 
29
20
  # Get Range
@@ -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
@@ -15,16 +15,7 @@ module JPSClient
15
15
  path = config["url"]
16
16
  path = path.gsub("{categoryIdStr}", categoryIdStr.to_s)
17
17
 
18
- response = @http_client.post(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.post(path, body: params)
24
- result = JPSClient::Response.new(response)
25
- end
26
-
27
- return result.to_h
18
+ return request_with_auth(:post, path, body: params)
28
19
  end
29
20
 
30
21
  # Get History Version Detail
@@ -38,16 +29,7 @@ module JPSClient
38
29
  path = config["url"]
39
30
  path = path.gsub("{applicationId}", applicationId.to_s)
40
31
 
41
- response = @http_client.get(path, params: params)
42
- result = JPSClient::Response.new(response)
43
-
44
- if result.need_login?
45
- do_login(force_login: true)
46
- response = @http_client.get(path, params: params)
47
- result = JPSClient::Response.new(response)
48
- end
49
-
50
- return result.to_h
32
+ return request_with_auth(:get, path, params: params)
51
33
  end
52
34
 
53
35
  # Get Change Record Detail
@@ -61,16 +43,7 @@ module JPSClient
61
43
  path = config["url"]
62
44
  path = path.gsub("{applicationId}", applicationId.to_s)
63
45
 
64
- response = @http_client.get(path, params: params)
65
- result = JPSClient::Response.new(response)
66
-
67
- if result.need_login?
68
- do_login(force_login: true)
69
- response = @http_client.get(path, params: params)
70
- result = JPSClient::Response.new(response)
71
- end
72
-
73
- return result.to_h
46
+ return request_with_auth(:get, path, params: params)
74
47
  end
75
48
  end
76
49
  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 Add
@@ -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
  end
51
33
  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
  # Create Application 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 Application 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
 
96
60
  # Delete Application Category
@@ -104,16 +68,7 @@ module JPSClient
104
68
  path = config["url"]
105
69
  path = path.gsub("{categoryId}", categoryId.to_s)
106
70
 
107
- response = @http_client.delete(path)
108
- result = JPSClient::Response.new(response)
109
-
110
- if result.need_login?
111
- do_login(force_login: true)
112
- response = @http_client.delete(path)
113
- result = JPSClient::Response.new(response)
114
- end
115
-
116
- return result.to_h
71
+ return request_with_auth(:delete, path)
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
  # Create Check
@@ -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 Designs
@@ -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 Versions
@@ -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 Designs
@@ -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
  end
117
72
  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 Assets 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 Assets 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
  # Create Assets Categories
@@ -104,16 +68,7 @@ module JPSClient
104
68
 
105
69
  path = config["url"]
106
70
 
107
- response = @http_client.post(path, body: params)
108
- result = JPSClient::Response.new(response)
109
-
110
- if result.need_login?
111
- do_login(force_login: true)
112
- response = @http_client.post(path, body: params)
113
- result = JPSClient::Response.new(response)
114
- end
115
-
116
- return result.to_h
71
+ return request_with_auth(:post, path, body: params)
117
72
  end
118
73
  end
119
74
  end