[refs #374] Update api platforms list docs and code

This commit is contained in:
konstantin.grabar 2012-09-20 19:07:06 +04:00
parent ecc4bcf5f1
commit e027eee40c
3 changed files with 55 additions and 0 deletions

View File

@ -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"

View File

@ -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

View File

@ -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)