@@ -181,7 +181,7 @@ if [ "$registerF" == 1 ]; then
181181 if ! [ -z " $register_credentials " ]; then
182182 check_creds " $register_credentials "
183183
184- data=$( curl -s " http://localhost /Register/username=" $username " &password=" $password " " )
184+ data=$( curl -s " " $server_address " /Register/username=" $username " &password=" $password " " )
185185
186186 if [ $( jq -r " .status" <<< " $data" ) == " success" ]; then
187187 userAuthKey=$( jq -r " .key" <<< " $data" )
@@ -204,7 +204,7 @@ if [ "$restoreF" == 1 ];then
204204 restoreF=0
205205 if ! [ -z " $restore_credentials " ]; then
206206 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 " )
208208 echo -e " \n--------------------\nKey recovery agent :\n--------------------"
209209 if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
210210 userKey=$( jq -r " .key" <<< " $responce" )
222222# Order ticket NOT DONE
223223if [ " $orderF " == 1 ]; then
224224 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 " " )
226226 if [ $( jq -r " .status" <<< " $response" ) == " success" ]; then
227227 orderID=$( jq -r " .OrderID" <<< " $response" )
228228 echo " Your order number is : " $orderID " , enjoy!"
239239# Cancel ordered ticket NOT DONE
240240if [ " $cancelF " == 1 ]; then
241241 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" )
243243 if [ " $cancel_result " == " success" ]; then
244244 echo " Your ticket number \" " $cancel_movie_id " \" been cancelled!"
245245 else
255255# History view NOT DONE
256256if [ " $historyF " == 1 ]; then
257257 if ! [ -z " $userKey " ]; then
258- history_list=$( curl " http://lcalhost /History/key=" $userKey " " )
258+ history_list=$( curl " " $server_address " /History/key=" $userKey " " )
259259
260260 # !!!! implement iteration to print history list
261261 else
262262 echo " No credentials provided"
263263 fi
264264fi
265265
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-
275266
276267function printMovie(){
277268
@@ -285,10 +276,10 @@ function printMovie(){
285276
286277# Get all movies list
287278if [ " $moviesF " == 1 ]; then
288- movies_list=" $( curl -s " http://localhost /Movies/" ) "
279+ movies_list=" $( curl -s " " $server_address " /Movies/" ) "
289280 if [ " $( jq -r " .status" <<< " $movies_list" ) " == " success" ]; then
290281
291- length=" $( curl -s " http://localhost /Movies/" | jq .movies | jq length) "
282+ length=" $( curl -s " " $server_address " /Movies/" | jq .movies | jq length) "
292283 format=" %3s | %-6s | %-50s\n" # format for output
293284 printf " \nFull Movies list :\n---------------------------\n$format --------------------------------------------------------\n" " ID" " Year" " Movie title"
294285 for i in ` seq 0 " $length " ` ;
@@ -305,7 +296,7 @@ if [ "$moviesF" == 1 ]; then
305296fi
306297# get and prints movie by ID
307298function printMoviesbyID(){
308- responce=$( curl -s http://localhost/ Movies/ID=" $movieID " )
299+ responce=$( curl -s " " $server_address " / Movies/ID=" $movieID " " )
309300 if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
310301 movie=" $( jq " .movies" <<< $responce ) "
311302 if [ " $movie " != null ]; then
@@ -327,10 +318,10 @@ function printMoviesbyID(){
327318
328319
329320function printMoviesList(){
330- responce=$( curl -s http://localhost/ Movies/title=" $movieName " )
321+ responce=$( curl -s " " $server_address " / Movies/title=" $movieName " " )
331322 if [ $( jq -r " .status" <<< " $responce" ) == " success" ]; then
332323 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) "
334325 if [ " $arraySize " == 1 ]; then
335326 movie=" $( jq -r " .[0]" <<< $movies_list ) "
336327 movieID=" $( jq -r " .id" <<< $movie ) "
@@ -383,8 +374,8 @@ function printOneLocation(){
383374}
384375
385376function 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)
388379 for i in ` seq 0 $length ` ;
389380 do
390381 current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
@@ -397,7 +388,7 @@ function printAllLocations(){
397388
398389function printLocationByID(){
399390 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])
401392 printOneLocation " $location "
402393 else
403394 echo " No movie ID received"
@@ -408,8 +399,8 @@ function printLocationByID(){
408399
409400function printLocationByCity(){
410401 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)
413404 for i in ` seq 0 $length ` ; do
414405 current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
415406 printOneLocation " $current_movie "
@@ -423,8 +414,8 @@ function printLocationByCity(){
423414
424415function printLocationByCountry(){
425416 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)
428419 for i in ` seq 0 $length ` ; do
429420 current_movie=" $( jq -r " .locations[$i ]" <<< $locations ) "
430421 printOneLocation " $current_movie "
0 commit comments