-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
api.rb
98 lines (75 loc) · 2.48 KB
/
api.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Openfoodnetwork::Application.routes.draw do
mount Rswag::Ui::Engine => '/api-docs'
mount Rswag::Api::Engine => '/api-docs'
namespace :api do
# Mount DFC API endpoints
#
# The DFC prototype is still pointing to the old URL though:
mount DfcProvider::Engine, at: '/dfc-v1.6/', as: :legacy_dfc_provider_engine
mount DfcProvider::Engine, at: '/dfc-v1.7/', as: :v1_7_dfc_provider_engine
# Latest implemented version:
mount DfcProvider::Engine, at: '/dfc/'
namespace :v0 do
resources :products do
collection do
get :bulk_products
get :overridable
end
post :clone
resources :variants
end
resources :variants, :only => [:index]
resources :orders, only: [:index, :show, :update] do
member do
put :capture
put :ship
end
resources :shipments, :only => [:create, :update] do
member do
put :ready
put :ship
put :add
put :remove
end
end
end
resources :enterprises do
post :update_image, on: :member
resource :logo, only: [:destroy]
resource :promo_image, only: [:destroy]
resource :terms_and_conditions, only: [:destroy]
end
resources :shops, only: [:show] do
collection do
get :closed_shops
end
end
resources :order_cycles do
get :products, on: :member
get :taxons, on: :member
get :properties, on: :member
get :producer_properties, on: :member
end
resources :exchanges, only: [:show], to: 'exchange_products#index' do
get :products, to: 'exchange_products#index'
end
resource :status do
get :job_queue
end
resources :customers, only: [:index, :update]
resources :enterprise_fees, only: [:destroy]
post '/product_images/:product_id', to: 'product_images#update_product_image'
resources :states, :only => [:index, :show]
resources :taxons, except: %i[show edit]
get '/reports/:report_type(/:report_subtype)', to: 'reports#show',
constraints: lambda { |_| OpenFoodNetwork::FeatureToggle.enabled?(:api_reports) }
end
namespace :v1 do
resources :customers
resources :enterprises do
resources :customers, only: :index
end
end
match '*path', to: redirect(path: "/api/v0/%{path}"), via: :all, constraints: { path: /(?!v[0-9]).+/ }
end
end