mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-11-28 00:20:26 +08:00
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.
13 lines
355 B
Ruby
13 lines
355 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Serializers::GithubCacheEntry < Serializers::Base
|
|
def self.serialize_internal(cache_entry, options = {})
|
|
{
|
|
id: cache_entry.ubid,
|
|
installation_name: options[:installation].name,
|
|
repository_name: options[:repository].name,
|
|
key: cache_entry.key,
|
|
size: cache_entry.size
|
|
}
|
|
end
|
|
end
|