Skip to content

Commit

Permalink
[feat]: add methods for app hook deliveries
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd authored Sep 29, 2023
2 parents e264213 + 733b5b5 commit bd95b27
Show file tree
Hide file tree
Showing 5 changed files with 541 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/octokit/client/apps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,31 @@ def find_installation_repositories_for_user(installation, options = {})
def delete_installation(installation, options = {})
boolean_from_response :delete, "app/installations/#{installation}", options
end

# Returns a list of webhook deliveries for the webhook configured for a GitHub App.
#
# @param options [Hash] A customizable set of options
#
# @see https://docs.github.com/en/rest/apps/webhooks#list-deliveries-for-an-app-webhook
#
# @return [Array<Hash>] an array of hook deliveries
def list_app_hook_deliveries(options = {})
paginate('app/hook/deliveries', options) do |data, last_response|
data.concat last_response.data
end
end

# Redeliver a delivery for the webhook configured for a GitHub App.
#
# @param delivery_id [Integer] The id of a GitHub App Hook Delivery
# @param options [Hash] A customizable set of options
#
# @see https://developer.github.com/v3/apps/#redeliver-a-delivery-for-an-app-webhook
#
# @return [Boolean] Success
def deliver_app_hook(delivery_id, options = {})
boolean_from_response :post, "app/hook/deliveries/#{delivery_id}/attempts", options
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"http_interactions": [
{
"request": {
"method": "post",
"uri": "https://api.github.com/app/hook/deliveries/55148726666/attempts",
"body": {
"encoding": "UTF-8",
"base64_string": "e30=\n"
},
"headers": {
"Accept": [
"application/vnd.github.v3+json"
],
"User-Agent": [
"Octokit Ruby Gem 7.1.0"
],
"Content-Type": [
"application/json"
],
"Authorization": [
"Bearer <JWT_BEARER_TOKEN>"
],
"Accept-Encoding": [
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
]
}
},
"response": {
"status": {
"code": 202,
"message": "Accepted"
},
"headers": {
"Server": [
"GitHub.com"
],
"Date": [
"Sat, 09 Sep 2023 18:40:05 GMT"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"2"
],
"X-Github-Media-Type": [
"github.v3; format=json"
],
"X-Github-Api-Version-Selected": [
"2022-11-28"
],
"Access-Control-Expose-Headers": [
"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset"
],
"Access-Control-Allow-Origin": [
"*"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubdomains; preload"
],
"X-Frame-Options": [
"deny"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-Xss-Protection": [
"0"
],
"Referrer-Policy": [
"origin-when-cross-origin, strict-origin-when-cross-origin"
],
"Content-Security-Policy": [
"default-src 'none'"
],
"Vary": [
"Accept-Encoding, Accept, X-Requested-With"
],
"X-Github-Request-Id": [
"E90B:7D5B:A273CE:14E6D87:64FCBC05"
]
},
"body": {
"encoding": "UTF-8",
"base64_string": "e30=\n"
}
},
"recorded_at": "Sat, 09 Sep 2023 18:40:05 GMT"
}
],
"recorded_with": "VCR 6.2.0"
}
Loading

0 comments on commit bd95b27

Please sign in to comment.