@@ -181,7 +181,7 @@ if [ "$registerF" == 1 ]; then
181
181
if ! [ -z " $register_credentials " ]; then
182
182
check_creds " $register_credentials "
183
183
184
- data=$( curl -s " http://localhost /Register/username=" $username " &password=" $password " " )
184
+ data=$( curl -s " " $server_address " /Register/username=" $username " &password=" $password " " )
185
185
186
186
if [ $( jq -r " .status" <<< " $data" ) == " success" ]; then
187
187
userAuthKey=$( jq -r " .key" <<< " $data" )
@@ -204,7 +204,7 @@ if [ "$restoreF" == 1 ];then
204
204
restoreF=0
205
205
if ! [ -z " $restore_credentials " ]; then
206
206
check_creds " $restore_credentials "
207
- responce=$( curl -s " http://localhost /RecoverKey/username=$username &password=$password " )
207
+ responce=$( curl -s " " $server_address " /RecoverKey/username=$username &password=$password " )
208
208
echo -e " \n--------------------\nKey recovery agent :\n--------------------"
209
209
if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
210
210
userKey=$( jq -r " .key" <<< " $responce" )
222
222
# Order ticket NOT DONE
223
223
if [ " $orderF " == 1 ]; then
224
224
if ! [ -z " $userKey " ]; then
225
- response=$( curl -s " http://localhost /Order/orderID=" $movie_order_id " &key=" $userKey " " )
225
+ response=$( curl -s " " $server_address " /Order/orderID=" $movie_order_id " &key=" $userKey " " )
226
226
if [ $( jq -r " .status" <<< " $response" ) == " success" ]; then
227
227
orderID=$( jq -r " .OrderID" <<< " $response" )
228
228
echo " Your order number is : " $orderID " , enjoy!"
239
239
# Cancel ordered ticket NOT DONE
240
240
if [ " $cancelF " == 1 ]; then
241
241
if ! [ -z " $userKey " ]; then
242
- cancel_result=$( curl -s http://localhost/ Cancel/id=" $cancel_movie_id " & key=" $userKey " | jq " .result" )
242
+ cancel_result=$( curl -s " " $server_address " / Cancel/id=" $cancel_movie_id " &key=" $userKey " " | jq " .result" )
243
243
if [ " $cancel_result " == " success" ]; then
244
244
echo " Your ticket number \" " $cancel_movie_id " \" been cancelled!"
245
245
else
255
255
# History view NOT DONE
256
256
if [ " $historyF " == 1 ]; then
257
257
if ! [ -z " $userKey " ]; then
258
- history_list=$( curl " http://lcalhost /History/key=" $userKey " " )
258
+ history_list=$( curl " " $server_address " /History/key=" $userKey " " )
259
259
260
260
# !!!! implement iteration to print history list
261
261
else
262
262
echo " No credentials provided"
263
263
fi
264
264
fi
265
265
266
- # Locations print
267
- if [ " $locations " == 1 ]; then
268
- locations_list=$( curl " http://localhost/Locations/" )
269
-
270
- # !!!! implement iteration to print locations list
271
- fi
272
-
273
-
274
-
275
266
276
267
function printMovie(){
277
268
@@ -285,10 +276,10 @@ function printMovie(){
285
276
286
277
# Get all movies list
287
278
if [ " $moviesF " == 1 ]; then
288
- movies_list=" $( curl -s " http://localhost /Movies/" ) "
279
+ movies_list=" $( curl -s " " $server_address " /Movies/" ) "
289
280
if [ " $( jq -r " .status" <<< " $movies_list" ) " == " success" ]; then
290
281
291
- length=" $( curl -s " http://localhost /Movies/" | jq .movies | jq length) "
282
+ length=" $( curl -s " " $server_address " /Movies/" | jq .movies | jq length) "
292
283
format=" %3s | %-6s | %-50s\n" # format for output
293
284
printf " \nFull Movies list :\n---------------------------\n$format --------------------------------------------------------\n" " ID" " Year" " Movie title"
294
285
for i in ` seq 0 " $length " ` ;
@@ -305,7 +296,7 @@ if [ "$moviesF" == 1 ]; then
305
296
fi
306
297
# get and prints movie by ID
307
298
function printMoviesbyID(){
308
- responce=$( curl -s http://localhost/ Movies/ID=" $movieID " )
299
+ responce=$( curl -s " " $server_address " / Movies/ID=" $movieID " " )
309
300
if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
310
301
movie=" $( jq " .movies" <<< $responce ) "
311
302
if [ " $movie " != null ]; then
@@ -327,10 +318,10 @@ function printMoviesbyID(){
327
318
328
319
329
320
function printMoviesList(){
330
- responce=$( curl -s http://localhost/ Movies/title=" $movieName " )
321
+ responce=$( curl -s " " $server_address " / Movies/title=" $movieName " " )
331
322
if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
332
323
movies_list=" $( jq " .movies" <<< $responce ) "
333
- arraySize=" $( curl -s " http://localhost /Movies/title=$movieName " | jq .movies | jq length) "
324
+ arraySize=" $( curl -s " " $server_address " /Movies/title=$movieName " | jq .movies | jq length) "
334
325
if [ " $arraySize " == 1 ]; then
335
326
movie=" $( jq -r " .[0]" <<< $movies_list ) "
336
327
movieID=" $( jq -r " .id" <<< $movie ) "
@@ -383,8 +374,8 @@ function printOneLocation(){
383
374
}
384
375
385
376
function printAllLocations(){
386
- locations=$( curl -s " http://localhost /Locations/" )
387
- length=$( curl -s " http://localhost /Locations/" | jq .locations | jq length)
377
+ locations=$( curl -s " " $server_address " /Locations/" )
378
+ length=$( curl -s " " $server_address " /Locations/" | jq .locations | jq length)
388
379
for i in ` seq 0 $length ` ;
389
380
do
390
381
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
@@ -397,7 +388,7 @@ function printAllLocations(){
397
388
398
389
function printLocationByID(){
399
390
if [ -n " $theaterID " ]; then
400
- location=$( curl -s " http://localhost /Locations/ID=" $theaterID " " | jq .locations[0])
391
+ location=$( curl -s " " $server_address " /Locations/ID=" $theaterID " " | jq .locations[0])
401
392
printOneLocation " $location "
402
393
else
403
394
echo " No movie ID received"
@@ -408,8 +399,8 @@ function printLocationByID(){
408
399
409
400
function printLocationByCity(){
410
401
if [ -n " $city " ]; then
411
- locations=$( curl -s " http://localhost /Locations/city=" $city " " )
412
- length=$( curl -s " http://localhost /Locations/city=" $city " " | jq .locations | jq length)
402
+ locations=$( curl -s " " $server_address " /Locations/city=" $city " " )
403
+ length=$( curl -s " " $server_address " /Locations/city=" $city " " | jq .locations | jq length)
413
404
for i in ` seq 0 $length ` ; do
414
405
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
415
406
printOneLocation " $current_movie "
@@ -423,8 +414,8 @@ function printLocationByCity(){
423
414
424
415
function printLocationByCountry(){
425
416
if [ -n " $country " ]; then
426
- locations=$( curl -s " http://localhost /Locations/country=" $country " " )
427
- length=$( curl -s " http://localhost /Locations/country=" $country " " | jq .locations | jq length)
417
+ locations=$( curl -s " " $server_address " /Locations/country=" $country " " )
418
+ length=$( curl -s " " $server_address " /Locations/country=" $country " " | jq .locations | jq length)
428
419
for i in ` seq 0 $length ` ; do
429
420
current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
430
421
printOneLocation " $current_movie "
0 commit comments