Sha256: d79330436991bd190bbf851e3b42c86c26ef65389d367eb32ed63b200d22b2f1
Contents?: true
Size: 1.18 KB
Versions: 12
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module ApiResources class Books include Praxis::EndpointDefinition media_type Book version '1.0' action :index do routing { get '' } params do attribute :fields, Praxis::Types::FieldSelector.for(Book), description: 'Fields with which to render the result.' attribute :filters, Praxis::Types::FilteringParams.for(Book) do filter 'author.name', using: %w[= != !], fuzzy: true filter 'author', using: %w[! !!] filter 'tags.name', using: %w[= !=] filter 'author.id', using: %w[= !=] filter 'id', using: %w[= !=] filter 'tags.taggings.tag.name', using: %w[= !=] end attribute :order, Praxis::Extensions::Pagination::OrderingParams.for(Book) do by_fields :id, 'author.name' end end response :ok, media_type: Praxis::Collection.of(Book) end action :show do routing { get '/:id' } params do attribute :id, description: 'ID to find' attribute :fields, Praxis::Types::FieldSelector.for(Book), description: 'Fields with which to render the result.' end response :ok end end end
Version data entries
12 entries across 12 versions & 1 rubygems