1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/doc/open_api/v1/bookable_machines_doc.rb
2022-12-21 14:14:29 +01:00

78 lines
3.0 KiB
Ruby

# frozen_string_literal: true
# openAPI documentation for bookable machines endpoint
class OpenAPI::V1::BookableMachinesDoc < OpenAPI::V1::BaseDoc
resource_description do
short 'Bookable machines'
desc 'Machines that a given user is allowed to book (allowed to make a reservation)'
formats FORMATS
api_version API_VERSION
end
doc_for :index do
api :GET, "/#{API_VERSION}/bookable_machines", 'Bookable machines index'
description 'Machines that a given user is allowed to book. If the given user has machine credits due to his current subscription, ' \
'it will be reported in *hours_remaining*.'
param :user_id, Integer, required: true, desc: 'Id of the given user.'
param :machine_id, Integer, optional: true, desc: 'Id of a machine to filter by'
example <<-MACHINES
# /open_api/v1/bookable_machines?user_id=522
{
"machines": [
{
"id": 3,
"name": "Shopbot / Grande fraiseuse",
"slug": "shopbot-grande-fraiseuse",
"updated_at": "2014-08-19T11:01:12.919+02:00",
"created_at": "2014-06-30T03:32:31.982+02:00",
"description": "La fraiseuse numériq ... ",
"spec": "Surface maximale de travail: 244 ... "
"hours_remaining": 0
},
{
"id": 5,
"name": "Petite Fraiseuse",
"slug": "petite-fraiseuse",
"updated_at": "2014-06-30T14:33:37.638+02:00",
"created_at": "2014-06-30T03:32:31.989+02:00",
"description": "La fraiseuse numérique Roland Modela MDX-20 ... ",
"spec": "Taille du plateau X/Y : 220 mm x 1 ... "
"hours_remaining": 0
},
{
"id": 2,
"name": "Découpeuse vinyle",
"slug": "decoupeuse-vinyle",
"updated_at": "2014-06-30T15:10:14.272+02:00",
"created_at": "2014-06-30T03:32:31.977+02:00",
"description": "La découpeuse Vinyle, Roland CAMM ...",
"spec": "Largeurs de support acceptées: de 50 mm à 70 ... 50 cm/sec ... mécanique: 0,0125 mm/pas",
"hours_remaining": 0
},
{
"id": 1,
"name": "Epilog EXT36 Laser",
"slug": "decoupeuse-laser",
"updated_at": "2015-02-17T11:06:00.495+01:00",
"created_at": "2014-06-30T03:32:31.972+02:00",
"description": "La découpeuse Laser, ... ",
"spec": "Puissance : 40W Surface de trav ... ",
"hours_remaining": 0
},
{
"id": 4,
"name": "Imprimante 3D - Ultimaker",
"slug": "imprimante-3d",
"updated_at": "2014-12-11T15:47:02.215+01:00",
"created_at": "2014-06-30T03:32:31.986+02:00",
"description": "L'imprimante 3D U ... ",
"spec": "Surface maximale de travai sés: PLA (en stock).",
"hours_remaining": 10
},
# ...
]
}
MACHINES
end
end