#706: some refactoring, updated build_list API response
This commit is contained in:
parent
4680e9c62c
commit
f67a8b3692
|
@ -12,32 +12,41 @@ json.build_list do |json|
|
|||
json.updated_at @build_list.updated_at.to_i
|
||||
|
||||
json.project do |json_project|
|
||||
json_project.(@build_list.project, :id, :name)
|
||||
json_project.fullname @build_list.project.name_with_owner
|
||||
json_project.url api_v1_project_path(@build_list.project, :format => :json)
|
||||
json.partial! 'api/v1/projects/project',
|
||||
:project => @build_list.project, :json => json_project
|
||||
end
|
||||
|
||||
json.save_to_repository do |json_save_to_repository|
|
||||
json_save_to_repository.(@build_list.save_to_repository, :id, :name)
|
||||
json.partial! 'api/v1/repositories/repository',
|
||||
:repository => @build_list.save_to_repository,
|
||||
:json => json_save_to_repository
|
||||
|
||||
json_save_to_repository.platform do |json_str_platform|
|
||||
json_str_platform.(@build_list.save_to_repository.platform, :id, :name)
|
||||
json_str_platform.url api_v1_platform_path(@build_list.save_to_repository.platform, :format => :json)
|
||||
json.partial! 'api/v1/platforms/platform',
|
||||
:platform => @build_list.save_to_repository.platform,
|
||||
:json => json_str_platform
|
||||
end
|
||||
|
||||
json_save_to_repository.url api_v1_repository_path(@build_list.save_to_repository, :format => :json)
|
||||
end
|
||||
|
||||
json.build_for_platform do |json_build_for_platform|
|
||||
json_build_for_platform.(@build_list.build_for_platform, :id, :name)
|
||||
json_build_for_platform.url api_v1_platform_path(@build_list.build_for_platform, :format => :json)
|
||||
json.partial! 'api/v1/platforms/platform',
|
||||
:platform => @build_list.build_for_platform,
|
||||
:json => json_build_for_platform
|
||||
end
|
||||
|
||||
json.partial! 'api/v1/shared/owner', :owner => @build_list.project.owner
|
||||
|
||||
inc_repos = Repository.includes(:platform).where(:id => @build_list.include_repos)
|
||||
json.include_repos inc_repos do |json_include_repos, repo|
|
||||
json_include_repos.(repo, :id, :name)
|
||||
json.partial! 'api/v1/repositories/repository',
|
||||
:repository => repo,
|
||||
:json => json_include_repos
|
||||
|
||||
json_include_repos.platform do |json_str_platform|
|
||||
json.partial! 'api/v1/platforms/platform',
|
||||
:platform => repo.platform,
|
||||
:json => json_str_platform
|
||||
end
|
||||
end
|
||||
|
||||
json.advisory do |json_advisory|
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
json.(platform, :id, :name)
|
||||
json.url api_v1_platform_path(platform.id, :format => :json)
|
|
@ -1,11 +1,11 @@
|
|||
json.platforms @platforms do |json, platform|
|
||||
json.(platform, :id, :name, :platform_type, :visibility)
|
||||
json.partial! 'platform', :platform => platform, :json => json
|
||||
json.(platform, :platform_type, :visibility)
|
||||
json.partial! 'api/v1/shared/owner', :owner => platform.owner
|
||||
json.repositories platform.repositories do |json_repos, repo|
|
||||
json_repos.(repo, :id, :name)
|
||||
json_repos.url api_v1_repository_path(repo.id, :format => :json)
|
||||
end
|
||||
json.url api_v1_platform_path(platform.id, :format => :json)
|
||||
end
|
||||
|
||||
json.url api_v1_platforms_path(:format => :json)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
json.platform do |json|
|
||||
json.(@platform, :id)
|
||||
json.partial! 'platform', :platform => @platform, :json => json
|
||||
json.partial! 'api/v1/shared/members'
|
||||
end
|
||||
json.url members_api_v1_platform_path(@platform.id, :format => :json)
|
|
@ -1,5 +1,6 @@
|
|||
json.platform do |json|
|
||||
json.(@platform, :id, :name, :description, :parent_platform_id, :released, :visibility, :platform_type, :distrib_type)
|
||||
json.partial! 'platform', :platform => @platform, :json => json
|
||||
json.(@platform, :description, :parent_platform_id, :released, :visibility, :platform_type, :distrib_type)
|
||||
json.created_at @platform.created_at.to_i
|
||||
json.updated_at @platform.updated_at.to_i
|
||||
json.partial! 'api/v1/shared/owner', :owner => @platform.owner
|
||||
|
@ -7,5 +8,4 @@ json.platform do |json|
|
|||
json_repos.(repo, :id, :name)
|
||||
json_repos.url api_v1_repository_path(repo.id, :format => :json)
|
||||
end
|
||||
end
|
||||
json.url api_v1_platform_path(@platform.id, :format => :json)
|
||||
end
|
Loading…
Reference in New Issue