forked from hrlagana/wimaxrf_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wimaxrf_doc_server.rb
221 lines (116 loc) · 3.28 KB
/
wimaxrf_doc_server.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#wimaxrf.rb
require 'sinatra/base'
require 'json'
class DocServer < Sinatra::Base
set :public_folder, 'swagger-ui/dist'
set :bind, '0.0.0.0'
before do
response.headers['Access-Control-Allow-Origin'] = '*'
end
get '/' do
redirect '/index.html'
end
get '/api/api-docs' do
content_type :json
'{
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"authorizations":{},
"apis":[
{"path": "/default",
"description": "Restore Base Station parameters from default configuration"
},
{"path": "/get",
"description": "Get Base station Static Parameter"
},
{"path": "/Info",
"description": "Get information about the Base Station."
},
{"path": "/inservice",
"description": "Set Base Station in service state"
},
{"path": "/maintenance",
"description": "Set Base Station to maintenance state"
},
{"path": "/restart",
"description": "Restart the Base Station"
},
{"path": "/set",
"description": "Set Basestation Static Parameter"
},
{"path": "/status",
"description": "Get status of WiMAX RF service"
},
{"path": "/mobileclient",
"description": "Get/Set parameters through mobile client"
},
{"path": "/monitor",
"description": "Get information about the mobile station"
},
{"path": "/reregister",
"description": "Re-register Mobile station"
},
{"path": "/showregister",
"description": "Get all registered mobile stations"
}
],
"info": {
"title": "NITlab WiMAX RF services",
"description": "This is reference document for the WiMAX RF API provided by NITlab.",
"termsOfServiceUrl": "",
"contact": "",
"license": "",
"licenseUrl": ""
}
}'
end
get '/api/api-docs/default' do
content_type :json
File.read('api/v1/default.json')
end
get '/api/api-docs/get' do
content_type :json
File.read('api/v1/get.json')
end
get '/api/api-docs/Info' do
content_type :json
File.read('api/v1/info.json')
end
get '/api/api-docs/inservice' do
content_type :json
File.read('api/v1/inservice.json')
end
get '/api/api-docs/maintenance' do
content_type :json
File.read('api/v1/maintenance.json')
end
get '/api/api-docs/restart' do
content_type :json
File.read('api/v1/restart.json')
end
get '/api/api-docs/set' do
content_type :json
File.read('api/v1/set.json')
end
get '/api/api-docs/status' do
content_type :json
File.read('api/v1/status.json')
end
get '/api/api-docs/mobileclient' do
content_type :json
File.read('api/v1/mobileclient.json')
end
get '/api/api-docs/monitor' do
content_type :json
File.read('api/v1/monitor.json')
end
get '/api/api-docs/reregister' do
content_type :json
File.read('api/v1/reregister.json')
end
get '/api/api-docs/showregister' do
content_type :json
File.read('api/v1/showregister.json')
end
end
DocServer.run!