From 71ea42e080645fb0ef10232c235a769795f14cef Mon Sep 17 00:00:00 2001 From: bspeice Date: Sun, 20 Oct 2013 17:34:42 -0400 Subject: [PATCH] Split the RegistrationClient into registration and parking --- .../uncc/gameday/parking/ParkingClient.java | 44 +++++++++++++++++++ .../registration/RegistrationClient.java | 23 ---------- 2 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 src/com/uncc/gameday/parking/ParkingClient.java diff --git a/src/com/uncc/gameday/parking/ParkingClient.java b/src/com/uncc/gameday/parking/ParkingClient.java new file mode 100644 index 0000000..d25e217 --- /dev/null +++ b/src/com/uncc/gameday/parking/ParkingClient.java @@ -0,0 +1,44 @@ +package com.uncc.gameday.parking; + +import java.util.List; + +import retrofit.RestAdapter; +import android.content.Context; + +import com.uncc.gameday.R; +import com.uncc.gameday.rest.GamedayService; + +public class ParkingClient { + + private GamedayService gds; + + public ParkingClient(Context c) { + RestAdapter ra = new RestAdapter.Builder() + .setServer("http://" + c.getString(R.string.server_hostname)) + .build(); + gds = ra.create(GamedayService.class); + } + + public List listLots() { + return gds.listLots(); + } + + public ParkingLot listLot(ParkingChoices choice) { + return gds.listLot(choice.getValue()); + } + + public ParkingLot listLot(ParkingLot lot) { + return gds.listLot(lot.getLocation().getValue()); + } + + public void rateLot(RatingChoices rating, ParkingChoices parkingLot) { + ParkingRating pRating = new ParkingRating(); + pRating.setParkingLot(parkingLot); + pRating.setRating(rating); + gds.rateLot(pRating, new ParkingLotCallback()); + } + + public void rateLot(ParkingRating rating) { + gds.rateLot(rating, new ParkingLotCallback()); + } +} diff --git a/src/com/uncc/gameday/registration/RegistrationClient.java b/src/com/uncc/gameday/registration/RegistrationClient.java index 892547d..f20a00b 100644 --- a/src/com/uncc/gameday/registration/RegistrationClient.java +++ b/src/com/uncc/gameday/registration/RegistrationClient.java @@ -24,29 +24,6 @@ public class RegistrationClient { gds = ra.create(GamedayService.class); } - public List listLots() { - return gds.listLots(); - } - - public ParkingLot listLot(ParkingChoices choice) { - return gds.listLot(choice.getValue()); - } - - public ParkingLot listLot(ParkingLot lot) { - return gds.listLot(lot.getLocation().getValue()); - } - - public void rateLot(RatingChoices rating, ParkingChoices parkingLot) { - ParkingRating pRating = new ParkingRating(); - pRating.setParkingLot(parkingLot); - pRating.setRating(rating); - gds.rateLot(pRating, new ParkingLotCallback()); - } - - public void rateLot(ParkingRating rating) { - gds.rateLot(rating, new ParkingLotCallback()); - } - public void registerAttendee(Attendee a) { gds.registerUser(a, new AttendeeCallback()); }