Browse Source

新增:开源健康度量开发群

pull/347/head
yystopf 1 year ago
parent
commit
2140a163ea
2 changed files with 27 additions and 0 deletions
  1. +22
    -0
      app/controllers/api/v1/projects/oss_health_measuring_controller.rb
  2. +5
    -0
      config/routes/api.rb

+ 22
- 0
app/controllers/api/v1/projects/oss_health_measuring_controller.rb View File

@@ -0,0 +1,22 @@
class Api::V1::Projects::OssHealthMeasuringController < Api::V1::BaseController
def index

url = URI("#{EduSetting.get("ohm_server_url")}/api/OSS_Health_Measuring/#{params[:owner]}/#{params[:repo]}")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
response = http.request(request)
render :json=> response.read_body
end

def can_get
url = URI("#{EduSetting.get("ohm_server_url")}/api/OHM_can_get/#{params[:owner]}/#{params[:repo]}")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
response = http.request(request)
render :json=> response.read_body
end

end

+ 5
- 0
config/routes/api.rb View File

@@ -131,6 +131,11 @@ defaults format: :json do

# projects文件夹下的
scope module: :projects do
resources :oss_health_measuring, only: [:index] do
collection do
get :can_get
end
end
resources :portrait, only: [:index]
resources :sync_repositories, only: [:create, :index] do
collection do


Loading…
Cancel
Save