-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.rb
128 lines (106 loc) · 5.14 KB
/
routes.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
################################################################################
#This file is part of Dedomenon.
#
#Dedomenon is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#Dedomenon is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU Affero General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with Dedomenon. If not, see <http://www.gnu.org/licenses/>.
#
#Copyright 2008 Raphaël Bauduin
################################################################################
# REST shoudl be disable while running the tests.
# REST shold also be disabled if you are accessing the application from the
# old interface.
enable_rest = true
# *REST_API_REFERENCE_CHART*
#
# *Resources*
# Below is the list of resources available so far. The respective id of each resourec
# just after it is implicit. For the last resource, its always :id otherwise
# its of the form :SingularFormOfResource_id like for entities, its :entity_id
#
# TODO: Add the route for links!
# * /accounts
# * /accounts/users
# * /account_types (proposed)
# * /account_types/account_type_values(proposed)
# * /data_types
# * /entities
# * /entities/details
# * /entities/instances
# * /entities/instances/details/
# * /entities/relations
# * /details
# * /details/status (proposed) would be propagated on all levels
# * /details/detail_value_propositions (proposed)
# * /databases
# * /databases/details
# * /databases/entities
# * /databases/entities/details
# * /databases/entities/instances
# * /databases/entities/relations
# * /instances (proposed)
# * /instances/details/ (proposed)
# * /instances/details/detail_values (proposed)
# * /instances/details/ddl_detail_values (proposed)
# * /instances/details/date_detail_values (proposed)
#
#
#
# For each resoruce exposed, you get following methods:
# _url full URL has a formatted version also
# _path only path has a formatted version also
#
# hash_for would return which controller, method etc.
# For exmaple, if you exposed resource databases wtih following:
# map.resources :databases
# Then you have following:
# databases_url
# databases_path
# hash_for_databases_url
# hash_for_databases_path
# formatted_databases_url
# formatted_databases_path
if enable_rest == true then
resources :data_types, :singular => 'data_type', :controller => 'rest/data_types'
resources :databases, :singular => 'database', :controller => 'rest/databases' do |database|
database.resources :entities, :singular => 'entity', :controller => 'rest/entities'
database.resources :details , :singular => 'detail', :controller => 'rest/details'
end
resources :entities, :singular => 'entity', :controller => 'rest/entities' do |entity|
entity.resources :details, :singular => 'detail', :controller => 'rest/details'
entity.resources :instances, :singular => 'instance', :controller => 'rest/instances'
entity.resources :relations, :singular => 'relation', :controller => 'rest/relations'
end
resources :details, :singular => 'detail', :controller => 'rest/details' do |detail|
detail.resources :propositions, :singular => 'proposition', :controller => 'rest/propositions'
# Useless
#detail.resources :values, :singular => 'value', :controller => 'rest/values'
end
resources :instances, :singular => 'instance', :controller => 'rest/instances' do |instance|
instance.resources :links, :singular => 'link', :controller => 'rest/links'
instance.resources :details, :singular => 'detail', :controller => 'rest/details' do |detail|
detail.resources :values, :singular => 'value', :controller => 'rest/values'
end
end
resources :links, :singular => 'link', :controller => 'rest/links'
resources :relations, :singular => 'relation', :controller => 'rest/relations'
resources :relation_side_types, :singular => 'relation_side_type', :controller => 'rest/relation_side_types'
resources :users, :singular => 'user', :controller => 'rest/users'
resources :user_types, :singular => 'user_type', :controller => 'rest/user_types'
resources :accounts, :singular => 'account', :controller => 'rest/accounts' do |account|
account.resources :users, :singular => 'user', :controller => 'rest/users'
account.resources :databases, :singular => 'database', :controller => 'rest/databases'
end
resources :account_types, :singular => 'account_type', :controller => 'rest/account_types'
resources :propositions, :singular => 'proposition', :controller => 'rest/propositions'
resources :detail_statuses, :singular => 'detail_status', :controller => 'rest/detail_statuses'
end