diff --git a/apidocs/lib/resources.rb b/apidocs/lib/resources.rb index 61ec16145..19b1fa88a 100644 --- a/apidocs/lib/resources.rb +++ b/apidocs/lib/resources.rb @@ -621,6 +621,13 @@ module GitHub "type" => "owner type", "url" => "path to owner data" }, + "repositories" => [ + { + "id" => "repository for package storage id", + "name" => "repository for package storage name", + "url" => "path to repository data page" + } + ], "url" => "path to platform data" } ] @@ -639,6 +646,18 @@ module GitHub "type" => "User", "url" => "/users/5.json" }, + "repositories" => [ + { + "id" => 26, + "name" => "main", + "url" => "/api/v1/repositories/26.json" + }, + { + "id" => 27, + "name" => "release", + "url" => "/api/v1/repositories/27.json" + } + ], "url" => "/api/v1/platforms/26.json" }, { @@ -652,6 +671,18 @@ module GitHub "type" => "User", "url" => "/timothy_bobrov.json" }, + "repositories" => [ + { + "id" => 28, + "name" => "main", + "url" => "/api/v1/repositories/28.json" + }, + { + "id" => 29, + "name" => "release", + "url" => "/api/v1/repositories/29.json" + } + ], "url" => "/api/v1/platforms/17.json" }, { @@ -665,6 +696,18 @@ module GitHub "type" => "User", "url" => "/users/4.json" }, + "repositories" => [ + { + "id" => 30, + "name" => "main", + "url" => "/api/v1/repositories/30.json" + }, + { + "id" => 31, + "name" => "release", + "url" => "/api/v1/repositories/31.json" + } + ], "url" => "/api/v1/platforms/18.json" }, ],"url" => "/api/v1/platforms.json" diff --git a/app/views/api/v1/platforms/index.json.jbuilder b/app/views/api/v1/platforms/index.json.jbuilder index 39b1e93df..ea6361322 100644 --- a/app/views/api/v1/platforms/index.json.jbuilder +++ b/app/views/api/v1/platforms/index.json.jbuilder @@ -5,6 +5,12 @@ json.platforms @platforms do |json, platform| json_owner.type platform.owner_type json_owner.url platform.owner_type == 'User' ? user_path(platform.owner) : group_path(platform.owner) end + json.repositories do |json_rep| + platform.repositories.each do |repo| + json_rep.(repo, :id, :name) + json_rep.url api_v1_repository_path(repo.name, :format => :json) + end + end json.url api_v1_platform_path(platform.name, :format => :json) end diff --git a/app/views/api/v1/platforms/show.json.jbuilder b/app/views/api/v1/platforms/show.json.jbuilder index b7751f738..f21343f1d 100644 --- a/app/views/api/v1/platforms/show.json.jbuilder +++ b/app/views/api/v1/platforms/show.json.jbuilder @@ -7,5 +7,11 @@ json.platform do |json| json_owner.type @platform.owner_type json_owner.url @platform.owner_type == 'User' ? user_path(@platform.owner) : group_path(@platform.owner) end + json.repositories do |json_rep| + @platform.repositories.each do |repo| + json_rep.(repo, :id, :name) + json_rep.url api_v1_repository_path(repo.name, :format => :json) + end + end end json.url api_v1_platform_path(@platform, :format => :json)