ubicloud/serializers/github_installation.rb
Jeremy Evans 8f66031bf6 Add support for managing github installations/repositories/cache entries to the API
This adds the following paths to the API:

```
/github
  get # list installations
/github/{installation_id}
  get # show installation
/github/{installation_id}/repository
  get # list repositories for installation
/github/{installation_id}/repository/{repository_id}
  get # show repository
/github/{installation_id}/repository/{repository_id}/cache
  get # list cache entries for repository
/github/{installation_id}/repository/{repository_id}/cache/{cache_entry_id}
  get # show cache entry
  delete # remove cache entry
```

This adds the GITHUB_{INSTALLATION,REPOSITORY}_NAME_OR_UBID constants. As GitHub
user and repository naming do not match Ubicloud's default name format, this
requires supporting a custom regexp when setting up the constants.

This changes the project github route to support names in addition for ubids for
specifying the installation and repository.

This changes the path used to delete a GitHub cache entry. The path now includes
the repository. This is done so the web and api can use the same route. Deleting
a non-existant cache entry now returns 204 instead of 404, similar to the rest
of Clover.

This adds pagination to Github{Installation,Repository,CacheEntry}, for the
api routes that return lists.

This only adds some minimal specs. The CLI specs will cover the remaining logic.
2025-11-01 02:46:00 +09:00

10 lines
228 B
Ruby

# frozen_string_literal: true
class Serializers::GithubInstallation < Serializers::Base
def self.serialize_internal(installation, options = {})
{
id: installation.ubid,
name: installation.name
}
end
end