2019-03-26 14:27:39 +01:00
# frozen_string_literal: true
# openAPI documentation for reservations endpoint
2016-05-05 15:02:02 +02:00
class OpenAPI :: V1 :: ReservationsDoc < OpenAPI :: V1 :: BaseDoc
resource_description do
short 'Reservations'
desc 'Reservations made by users'
formats FORMATS
api_version API_VERSION
end
include OpenAPI :: V1 :: Concerns :: ParamGroups
doc_for :index do
2019-03-26 14:27:39 +01:00
api :GET , " / #{ API_VERSION } /reservations " , 'Reservations index'
2023-03-03 10:09:07 +01:00
description 'Index of reservations made by users, paginated. Ordered by *created_at* descendant.'
2016-05-05 15:02:02 +02:00
param_group :pagination
2023-03-06 16:35:50 +01:00
param :after , DateTime , optional : true , desc : 'Filter reservations to those created after the given date.'
param :before , DateTime , optional : true , desc : 'Filter reservations to those created before the given date.'
2019-03-26 14:27:39 +01:00
param :user_id , [ Integer , Array ] , optional : true , desc : 'Scope the request to one or various users.'
2021-06-28 09:50:37 +02:00
param :reservable_type , %w[ Event Machine Space Training ] , optional : true , desc : 'Scope the request to a specific type of reservable.'
2019-03-26 14:27:39 +01:00
param :reservable_id , [ Integer , Array ] , optional : true , desc : 'Scope the request to one or various reservables.'
2023-03-30 13:22:36 +02:00
param :availability_id , [ Integer , Array ] , optional : true , desc : 'Scope the request to one or various availabilities.'
2016-05-05 15:02:02 +02:00
2019-03-26 14:27:39 +01:00
example <<-RESERVATIONS
2016-05-05 15:02:02 +02:00
# /open_api/v1/reservations?reservable_type=Event&page=1&per_page=3
{
" reservations " : [
{
" id " : 3253 ,
" user_id " : 1744 ,
" reservable_id " : 162 ,
" reservable_type " : " Event " ,
" updated_at " : " 2016-05-03T14:14:00.141+02:00 " ,
" created_at " : " 2016-05-03T14:14:00.141+02:00 " ,
" user " : {
" id " : 1744 ,
" email " : " xxxxxxxxxxxx " ,
" created_at " : " 2016-05-03T13:51:03.223+02:00 " ,
" full_name " : " xxxxxxxxxxxx "
} ,
" reservable " : {
" id " : 162 ,
" title " : " INITIATION FAB LAB " ,
" description " : " A partir de 15 ans : \r \n \r \n Découvrez le Fab Lab, familiarisez-vous avec les découpeuses laser, les imprimantes 3D, la découpeuse vinyle ... ! Fabriquez un objet simple, à ramener chez vous ! \r \n \r \n Adoptez la Fab Lab attitude ! " ,
" updated_at " : " 2016-03-21T15:55:56.306+01:00 " ,
" created_at " : " 2016-03-21T15:55:56.306+01:00 "
2023-03-03 10:09:07 +01:00
} ,
" reserved_slots " : [
{
" canceled_at " : " 2016-05-20T09:40:12.201+01:00 " ,
2023-03-30 13:22:36 +02:00
" availability_id " : 5200 ,
2023-03-03 10:09:07 +01:00
" start_at " : " 2016-06-03T14:00:00.000+01:00 " ,
" end_at " : " 2016-06-03T15:00:00.000+01:00 "
}
]
2016-05-05 15:02:02 +02:00
} ,
{
" id " : 3252 ,
" user_id " : 1514 ,
" reservable_id " : 137 ,
" reservable_type " : " Event " ,
" updated_at " : " 2016-05-03T13:54:54.072+02:00 " ,
" created_at " : " 2016-05-03T13:54:54.072+02:00 " ,
" user " : {
" id " : 1514 ,
" email " : " xxxxxxxxxxxx " ,
" created_at " : " 2016-02-24T08:45:09.050+01:00 " ,
" full_name " : " xxxxxxxxxxxx "
} ,
" reservable " : {
" id " : 137 ,
" title " : " INITIATION FAB LAB " ,
" description " : " A partir de 15 ans : \r \n \r \n Découvrez le Fab Lab, familiarisez-vous avec les découpeuses laser, les imprimantes 3D, la découpeuse vinyle ... ! Fabriquez un objet simple, à ramener chez vous ! \r \n \r \n Adoptez la Fab Lab attitude ! " ,
" updated_at " : " 2016-05-03T13:53:47.172+02:00 " ,
" created_at " : " 2016-03-07T15:58:14.113+01:00 "
2023-03-03 10:09:07 +01:00
} ,
" reserved_slots " : [
{
" canceled_at " : null ,
2023-03-30 13:22:36 +02:00
" availability_id " : 5199 ,
2023-03-03 10:09:07 +01:00
" start_at " : " 2016-06-02T16:00:00.000+01:00 " ,
" end_at " : " 2016-06-02T17:00:00.000+01:00 "
}
]
2016-05-05 15:02:02 +02:00
} ,
{
" id " : 3251 ,
" user_id " : 1743 ,
" reservable_id " : 162 ,
" reservable_type " : " Event " ,
" updated_at " : " 2016-05-03T12:28:50.487+02:00 " ,
" created_at " : " 2016-05-03T12:28:50.487+02:00 " ,
" user " : {
" id " : 1743 ,
" email " : " xxxxxxxxxxxx " ,
" created_at " : " 2016-05-03T12:24:38.724+02:00 " ,
" full_name " : " xxxxxxxxxxxx "
} ,
" reservable " : {
" id " : 162 ,
" title " : " INITIATION FAB LAB " ,
" description " : " A partir de 15 ans : \r \n \r \n Découvrez le Fab Lab, familiarisez-vous avec les découpeuses laser, les imprimantes 3D, la découpeuse vinyle ... ! Fabriquez un objet simple, à ramener chez vous ! \r \n \r \n Adoptez la Fab Lab attitude ! " ,
" updated_at " : " 2016-03-21T15:55:56.306+01:00 " ,
" created_at " : " 2016-03-21T15:55:56.306+01:00 "
2023-03-03 10:09:07 +01:00
} ,
" reserved_slots " : [
{
" canceled_at " : null ,
2023-03-30 13:22:36 +02:00
" availability_id " : 5066 ,
2023-03-03 10:09:07 +01:00
" start_at " : " 2016-06-03T14:00:00.000+01:00 " ,
" end_at " : " 2016-06-03T15:00:00.000+01:00 "
}
]
2016-05-05 15:02:02 +02:00
}
]
}
2019-03-26 14:27:39 +01:00
RESERVATIONS
2016-05-05 15:02:02 +02:00
end
end