add: webhook tasks and test

This commit is contained in:
2021-07-28 14:27:11 +08:00
parent 8b53aac8a6
commit 264a831a1c
10 changed files with 1152 additions and 131 deletions

View File

@@ -2,7 +2,7 @@ json.id @webhook.id
json.(@webhook, :id, :http_method, :content_type, :url, :secret, :last_status, :is_active)
json.type @webhook.hook_task_type
json.create_time Time.at(@webhook.created_unix).strftime("%Y-%m-%d %H:%M:%S")
event = JSON.parse(@webhook.events)
event = @webhook.events
json.branch_filter event["branch_filter"]
if event["send_everything"]
json.events event["events"].keys

View File

@@ -0,0 +1,5 @@
json.total_count @tasks.total_count
json.tasks @tasks.each do |task|
json.(task, :id, :type, :uuid, :is_succeed, :is_delivered, :payload_content, :request_content, :response_content)
json.delivered_time Time.at(task.delivered*10**-9).strftime("%Y-%m-%d %H:%M:%S")
end