Files
openfoodnetwork/app/views/json/partials/_hub.rabl
2014-06-24 17:14:01 +10:00

24 lines
576 B
Ruby

child distributed_taxons: :taxons do
extends "json/taxon"
end
child suppliers: :producers do
attributes :id
end
node :path do |enterprise|
main_app.shop_enterprise_path(enterprise)
end
node :pickup do |hub|
hub.shipping_methods.where(:require_ship_address => false).present?
end
node :delivery do |hub|
hub.shipping_methods.where(:require_ship_address => true).present?
end
if @active_distributors
node :active do |hub|
@active_distributors.include?(hub)
end
end
node :orders_close_at do |hub|
OrderCycle.first_closing_for(hub).andand.orders_close_at
end