2023-03-02 17:42:10 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-05-04 18:17:50 +02:00
|
|
|
json.events @events do |event|
|
|
|
|
json.partial! 'open_api/v1/events/event', event: event
|
2016-08-31 11:58:37 +02:00
|
|
|
json.extract! event, :nb_total_places, :nb_free_places
|
2017-09-03 13:55:38 +02:00
|
|
|
json.start_at event.availability.start_at
|
|
|
|
json.end_at event.availability.end_at
|
2023-03-02 17:42:10 +01:00
|
|
|
json.category event.category.name
|
|
|
|
json.themes event.event_themes&.map(&:name)
|
|
|
|
json.age_range event.age_range&.name
|
2021-06-28 09:50:37 +02:00
|
|
|
if event.event_image
|
|
|
|
json.event_image do
|
|
|
|
json.large_url root_url.chomp('/') + event.event_image.attachment.large.url
|
|
|
|
json.medium_url root_url.chomp('/') + event.event_image.attachment.medium.url
|
|
|
|
json.small_url root_url.chomp('/') + event.event_image.attachment.small.url
|
|
|
|
end
|
2017-09-03 13:55:38 +02:00
|
|
|
end
|
2016-08-31 11:58:37 +02:00
|
|
|
json.prices do
|
|
|
|
json.normal do
|
|
|
|
json.name I18n.t('app.public.home.full_price')
|
|
|
|
json.amount event.amount
|
|
|
|
end
|
|
|
|
event.event_price_categories.each do |epc|
|
|
|
|
pc = epc.price_category
|
|
|
|
json.set! pc.id do
|
|
|
|
json.name pc.name
|
|
|
|
json.amount epc.amount
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-03-02 17:42:10 +01:00
|
|
|
json.url URI.join("#{ENV.fetch('DEFAULT_PROTOCOL')}://#{ENV.fetch('DEFAULT_HOST')}", "/#!/events/#{event.id}")
|
2016-05-04 18:17:50 +02:00
|
|
|
end
|