forgeplus/app/services/gitea/repository/webhooks/tasks_service.rb

28 lines
648 B
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Gitea::Repository::Webhooks::TasksService < Gitea::ClientService
attr_reader :token, :owner, :repo, :webhook_id
# ref: The name of the commit/branch/tag. Default the repositorys default branch (usually master)
# repo_name: the name of repository
def initialize(token, owner, repo, webhook_id)
@token = token
@owner = owner
@repo = repo
@webhook_id = webhook_id
end
def call
response = get(url, params)
render_response(response)
end
private
def params
Hash.new.merge(token: user.gitea_token)
end
def url
"/repos/#{owner}/#{repo}/hooks/#{webhook_id}/hook_tasks".freeze
end
end