From 8a4351850c1cdd038c022fdf3a36bb39e775eb38 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 19 Feb 2015 22:28:51 +0300 Subject: [PATCH] add visibility for all responses from Projects API --- app/views/api/v1/platforms/_platform.json.jbuilder | 2 +- app/views/api/v1/platforms/index.json.jbuilder | 1 - app/views/api/v1/platforms/show.json.jbuilder | 2 +- app/views/api/v1/projects/_project.json.jbuilder | 2 +- app/views/api/v1/projects/get_id.json.jbuilder | 1 - app/views/api/v1/projects/index.json.jbuilder | 2 +- app/views/api/v1/projects/show.json.jbuilder | 2 +- config/routes.rb | 2 +- 8 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/views/api/v1/platforms/_platform.json.jbuilder b/app/views/api/v1/platforms/_platform.json.jbuilder index a28a99d54..cb0df97e0 100644 --- a/app/views/api/v1/platforms/_platform.json.jbuilder +++ b/app/views/api/v1/platforms/_platform.json.jbuilder @@ -1,2 +1,2 @@ -json.(platform, :id, :name) +json.(platform, :id, :name, :visibility, :platform_type) json.url api_v1_platform_path(platform.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/platforms/index.json.jbuilder b/app/views/api/v1/platforms/index.json.jbuilder index 4995ecda8..9b1006186 100644 --- a/app/views/api/v1/platforms/index.json.jbuilder +++ b/app/views/api/v1/platforms/index.json.jbuilder @@ -1,6 +1,5 @@ json.platforms @platforms do |platform| json.partial! 'platform', platform: platform - json.(platform, :platform_type, :visibility) json.partial! 'api/v1/shared/owner', owner: platform.owner json.repositories platform.repositories do |repo| json.(repo, :id, :name) diff --git a/app/views/api/v1/platforms/show.json.jbuilder b/app/views/api/v1/platforms/show.json.jbuilder index 9c64cc7e9..99a4cbe31 100644 --- a/app/views/api/v1/platforms/show.json.jbuilder +++ b/app/views/api/v1/platforms/show.json.jbuilder @@ -1,6 +1,6 @@ json.platform do json.partial! 'platform', platform: @platform - json.(@platform, :description, :parent_platform_id, :released, :visibility, :platform_type, :distrib_type) + json.(@platform, :description, :parent_platform_id, :released, :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 diff --git a/app/views/api/v1/projects/_project.json.jbuilder b/app/views/api/v1/projects/_project.json.jbuilder index caddb99ec..682cec9ab 100644 --- a/app/views/api/v1/projects/_project.json.jbuilder +++ b/app/views/api/v1/projects/_project.json.jbuilder @@ -1,4 +1,4 @@ -json.(project, :id, :name) +json.(project, :id, :name, :visibility) json.fullname project.name_with_owner json.url api_v1_project_path(project.id, format: :json) json.git_url git_repo_url(project.name_with_owner) diff --git a/app/views/api/v1/projects/get_id.json.jbuilder b/app/views/api/v1/projects/get_id.json.jbuilder index d134c3870..0ffc8dc45 100644 --- a/app/views/api/v1/projects/get_id.json.jbuilder +++ b/app/views/api/v1/projects/get_id.json.jbuilder @@ -1,5 +1,4 @@ json.project do json.partial! 'project', project: @project - json.(@project, :visibility) json.partial! 'api/v1/shared/owner', owner: @project.owner end diff --git a/app/views/api/v1/projects/index.json.jbuilder b/app/views/api/v1/projects/index.json.jbuilder index b141b59a7..b141abd52 100644 --- a/app/views/api/v1/projects/index.json.jbuilder +++ b/app/views/api/v1/projects/index.json.jbuilder @@ -1,6 +1,6 @@ json.projects @projects do |project| json.partial! 'project', project: project - json.(project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) + json.(project, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) json.created_at project.created_at.to_i json.updated_at project.updated_at.to_i json.partial! 'api/v1/shared/owner', owner: project.owner diff --git a/app/views/api/v1/projects/show.json.jbuilder b/app/views/api/v1/projects/show.json.jbuilder index ecd9d382c..0254b1aaf 100644 --- a/app/views/api/v1/projects/show.json.jbuilder +++ b/app/views/api/v1/projects/show.json.jbuilder @@ -1,6 +1,6 @@ json.project do json.partial! 'project', project: @project - json.(@project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) + json.(@project, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) json.created_at @project.created_at.to_i json.updated_at @project.updated_at.to_i json.partial! 'api/v1/shared/owner', owner: @project.owner diff --git a/config/routes.rb b/config/routes.rb index dbda47e83..777f8d425 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,7 +31,7 @@ Rosa::Application.routes.draw do }, skip: [:registrations] namespace :api do - namespace :v1 do + namespace :v1, constraints: { format: 'json' }, defaults: { format: 'json' } do resources :advisories, only: [:index, :show, :create, :update] resources :search, only: [:index] resources :build_lists, only: [:index, :create, :show] do