mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-07-16 23:18:56 +08:00
ADD test devops
This commit is contained in:
@@ -21,9 +21,6 @@ class Gitea::ClientService < ApplicationService
|
||||
def post(url, params={})
|
||||
puts "[gitea] request params: #{params}"
|
||||
request_url = [api_url, url].join('').freeze
|
||||
Rails.logger.info("######_____api____request_url_______###############{request_url}")
|
||||
Rails.logger.info("######_____api____request_params_______###############{params}")
|
||||
|
||||
auth_token = authen_params(params[:token])
|
||||
response = conn(auth_token).post do |req|
|
||||
req.url "#{request_url}"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# creates a new OAuth2 application
|
||||
class Gitea::Oauth2::CreateService < Gitea::ClientService
|
||||
attr_reader :token, :params
|
||||
|
||||
# params:
|
||||
# {
|
||||
# "name": "string",
|
||||
# "redirect_uris": [
|
||||
# "string"
|
||||
# ]
|
||||
# }
|
||||
# ep: Gitea::OAuth2::CreateService.call(current_user.gitea_token, {name: 'oauth_name', redirect_uris: ['url']})
|
||||
# return values example:
|
||||
# {
|
||||
# "client_id": "string",
|
||||
# "client_secret": "string",
|
||||
# "created": "2020-07-08T03:12:49.960Z",
|
||||
# "id": 0,
|
||||
# "name": "string",
|
||||
# "redirect_uris": [
|
||||
# "string"
|
||||
# ]
|
||||
# }
|
||||
def initialize(token, params)
|
||||
@token = token
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
post(url, request_params)
|
||||
end
|
||||
|
||||
private
|
||||
def url
|
||||
"/user/applications/oauth2".freeze
|
||||
end
|
||||
|
||||
def request_params
|
||||
params.merge(token: token, data: params).compact
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user