namespace :v1 do get 'cookbooks' => 'cookbooks#index' get 'search' => 'cookbooks#search' get 'cookbooks/:cookbook' => 'cookbooks#show', as: :cookbook get 'cookbooks/:cookbook/versions/:version' => 'cookbook_versions#show', as: :cookbook_version post 'cookbooks' => 'cookbook_uploads#create' delete 'cookbooks/:cookbook' => 'cookbooks#destroy' end end end
do scope 'v1' do # routes for application/vnd.supermarket+json;version=1 end end end ! namespace :api, defaults: { format: :json } do namespace :v1 do # existing routes end end end
property :description ! link :self do api_v1_cookbook_url(represented) end ! collection :cookbook_versions, class: CookbookVersion do property :version property :license ! link :self do api_v1_cookbook_url(represented.cookbook, represented) end ! link :artifact do represented.tarball.url end end end
schema do type "cookbook" link :self, href: api_v1_cookbook_url(item) ! properties do |props| map_properties :name, :description ! entities :cookbook_versions, item.cookbook_versions, CookbookVersionSerializer end end end https://github.com/ismasan/oat