Skip to content

Commit 950c053

Browse files
committed
add api.md and modified gtt layer response data of project api
1 parent 273b93a commit 950c053

File tree

4 files changed

+128
-4
lines changed

4 files changed

+128
-4
lines changed

app/controllers/gtt_configuration_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def default_setting_configuration
1010
format.api { render json: build_default_setting_config}
1111
end
1212
end
13-
13+
1414
def build_default_setting_config
1515
default_tracker_icon = []
1616
default_status_color = []
@@ -71,4 +71,4 @@ def find_optional_project_and_authorize
7171
authorize_global
7272
end
7373
end
74-
end
74+
end

app/views/projects/show.api.rsb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ api.project do
1515
end
1616

1717
if @project.gtt_tile_sources.present?
18-
api.gtt_tile_sources @project.gtt_tile_sources
18+
api.gttLayer @project.gtt_tile_sources
1919
end
2020

2121
render_api_custom_values @project.visible_custom_field_values, api

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
scope 'gtt' do
1010
get 'settings', to: 'gtt_configuration#default_setting_configuration', as: :default_setting_configuration
11-
end
11+
end

doc/api.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# GTT API
2+
3+
## Global Level API Endpoint
4+
### API Endpoint
5+
```
6+
GET /gtt/settings.json
7+
```
8+
Get all the GTT default settings and also all the global GTT layers data.
9+
10+
***Request***
11+
```
12+
http://localhost:3000/gtt/settings.json
13+
```
14+
15+
***Response***
16+
```json
17+
{
18+
"gttDefaultSetting": {
19+
"defaultTrackerIcon": [
20+
{
21+
"trackerID": "1",
22+
"trackerName": "Task",
23+
"icon": "maki-square"
24+
},
25+
],
26+
"defaultStatusColor": [
27+
{
28+
"statusID": "1",
29+
"statusName": "New",
30+
"color": "#00ff00"
31+
},
32+
],
33+
"defaultMapSetting": {
34+
"centerLng": "135.35740",
35+
"centerLat": "34.74701"
36+
},
37+
"geometrySetting": {
38+
"geometryTypes": [
39+
"Point",
40+
"LineString",
41+
"Polygon"
42+
],
43+
"GeoJsonUpload": null
44+
},
45+
"geocoderSetting": {
46+
"enableGeocodingOnMap": "true",
47+
"geocoderOptions": "{}"
48+
}
49+
},
50+
"gttLayer": [
51+
{
52+
"id": 1,
53+
"name": "OSM",
54+
"type": "ol.source.OSM",
55+
"options": {
56+
"url": "https://tile.openstreetmap.jp/{z}/{x}/{y}.png",
57+
"custom": "17/34.74701/135.35740",
58+
"crossOrigin": null,
59+
"attributions": "<a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
60+
},
61+
},
62+
{
63+
"id": 2,
64+
"name": "GIS Satellite Map",
65+
"type": "ol.source.XYZ",
66+
"options": {
67+
"url": "https://cyberjapandata.gsi.go.jp/xyz/seamlessphoto/{z}/{x}/{y}.jpg",
68+
"maxZoom": 18,
69+
"minZoom": 0,
70+
"attributions": "<a href=\"https://portal.cyberjapan.jp/help/termsofuse.html\" target=\"_blank\">GISSateliteMap</a>"
71+
},
72+
}
73+
]
74+
}
75+
```
76+
77+
## Project Level API Endpoint
78+
### API Endpoint
79+
```
80+
GET /projects/{project_identifier}.json
81+
```
82+
Get project and selected GTT layer data of a specific project.
83+
84+
***Request***
85+
```
86+
http://localhost:3000/projects/1.json
87+
```
88+
***Response***
89+
```json
90+
{
91+
"project": {
92+
"id": 1,
93+
"name": "first testing project ",
94+
"identifier": "first-testing-project",
95+
"description": "",
96+
"homepage": "",
97+
"status": 1,
98+
"is_public": false,
99+
"geojson": "",
100+
"gttLayer": [
101+
{
102+
"id": 1,
103+
"name": "OSM",
104+
"type": "ol.source.OSM",
105+
"options": {
106+
"url": "https://tile.openstreetmap.jp/{z}/{x}/{y}.png",
107+
"custom": "17/34.74701/135.35740",
108+
"crossOrigin": null,
109+
"attributions": "<a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
110+
},
111+
"created_at": "2022-06-29T09:07:12.574Z",
112+
"updated_at": "2022-07-05T07:33:09.237Z",
113+
"global": true,
114+
"default": true,
115+
"position": 0,
116+
"baselayer": true
117+
}
118+
],
119+
"created_on": "2022-06-29T09:08:38Z",
120+
"updated_on": "2022-06-29T09:08:38Z"
121+
}
122+
}
123+
```
124+

0 commit comments

Comments
 (0)