api completion
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
require "grape"
|
||||
require "grape-swagger"
|
||||
require "ostruct"
|
||||
|
||||
class Api::Base < Grape::API
|
||||
format :json
|
||||
@@ -18,7 +17,9 @@ class Api::Base < Grape::API
|
||||
|
||||
resource :entries do
|
||||
desc "Return public entries in all languages",
|
||||
attributes: OpenStruct.new(success: nil, produces: nil)
|
||||
is_array: true,
|
||||
success: Api::Entities::Entry,
|
||||
produces: ["application/json"]
|
||||
params do
|
||||
optional :since,
|
||||
type: String,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
module Api
|
||||
module Entities
|
||||
class Entry < Grape::Entity
|
||||
expose :id, documentation: { type: "integer", format: "int64", desc: "Entry ID." }
|
||||
expose :category, documentation: { type: "string", desc: "Category label." }
|
||||
expose :fi, documentation: { type: "string", desc: "Finnish term/definition.", allow_nil: true }
|
||||
expose :en, documentation: { type: "string", desc: "English term/definition.", allow_nil: true }
|
||||
expose :sv, documentation: { type: "string", desc: "Swedish term/definition.", allow_nil: true }
|
||||
expose :no, documentation: { type: "string", desc: "Norwegian term/definition.", allow_nil: true }
|
||||
expose :ru, documentation: { type: "string", desc: "Russian term/definition.", allow_nil: true }
|
||||
expose :de, documentation: { type: "string", desc: "German term/definition.", allow_nil: true }
|
||||
expose :updated_at, documentation: { type: "string", format: "date-time", desc: "Last update timestamp (ISO8601)." }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user