From 7cefd630d306e00bcd812169742f3ad7fdcb8eea Mon Sep 17 00:00:00 2001 From: bspeice Date: Wed, 16 Oct 2013 14:39:43 -0400 Subject: [PATCH] Add the initial Retrofit REST API code Note: Completely untested, but it looks cool! --- .../gameday/registration/GamedayService.java | 15 ++++++++ .../gameday/registration/ParkingChoices.java | 19 ++++++++++ .../uncc/gameday/registration/ParkingLot.java | 8 +++++ .../gameday/registration/ParkingRating.java | 6 ++++ .../gameday/registration/RatingChoices.java | 12 +++++++ .../registration/RegistrationClient.java | 36 ------------------- 6 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 src/com/uncc/gameday/registration/GamedayService.java create mode 100644 src/com/uncc/gameday/registration/ParkingChoices.java create mode 100644 src/com/uncc/gameday/registration/ParkingLot.java create mode 100644 src/com/uncc/gameday/registration/ParkingRating.java create mode 100644 src/com/uncc/gameday/registration/RatingChoices.java delete mode 100644 src/com/uncc/gameday/registration/RegistrationClient.java diff --git a/src/com/uncc/gameday/registration/GamedayService.java b/src/com/uncc/gameday/registration/GamedayService.java new file mode 100644 index 0000000..f6c6185 --- /dev/null +++ b/src/com/uncc/gameday/registration/GamedayService.java @@ -0,0 +1,15 @@ +package com.uncc.gameday.registration; + +import java.util.List; + +import retrofit.http.*; + +public interface GamedayService { + + @GET("/lots/") + List listLots(); + + @POST("/rating/") + void rateLot(@Body ParkingRating rating, @Body ParkingChoices parking_lot); + +} diff --git a/src/com/uncc/gameday/registration/ParkingChoices.java b/src/com/uncc/gameday/registration/ParkingChoices.java new file mode 100644 index 0000000..18bc2f3 --- /dev/null +++ b/src/com/uncc/gameday/registration/ParkingChoices.java @@ -0,0 +1,19 @@ +package com.uncc.gameday.registration; + +public enum ParkingChoices { + GREEN ("GREEN"), + BLACK ("BLACK"), + RED ("RED"), + BLUE ("BLUE"), + SILVER ("SILVER"), + ORANGE ("ORANGE"), + YELLOW ("YELLOW"), + PURPLE ("PURPLE"), + PINK ("PINK"), + WHITE ("WHITE"), + GOLD ("GOLD"); + + String choice; + ParkingChoices(String choice) { this.choice = choice; } + public String getValue() { return choice; } +} \ No newline at end of file diff --git a/src/com/uncc/gameday/registration/ParkingLot.java b/src/com/uncc/gameday/registration/ParkingLot.java new file mode 100644 index 0000000..7352a50 --- /dev/null +++ b/src/com/uncc/gameday/registration/ParkingLot.java @@ -0,0 +1,8 @@ +package com.uncc.gameday.registration; + +public class ParkingLot { + + ParkingChoices location; + int filled_pct; + +} diff --git a/src/com/uncc/gameday/registration/ParkingRating.java b/src/com/uncc/gameday/registration/ParkingRating.java new file mode 100644 index 0000000..7a1a445 --- /dev/null +++ b/src/com/uncc/gameday/registration/ParkingRating.java @@ -0,0 +1,6 @@ +package com.uncc.gameday.registration; + +public class ParkingRating { + ParkingChoices parking_lot; + RatingChoices rating; +} diff --git a/src/com/uncc/gameday/registration/RatingChoices.java b/src/com/uncc/gameday/registration/RatingChoices.java new file mode 100644 index 0000000..3ebb82e --- /dev/null +++ b/src/com/uncc/gameday/registration/RatingChoices.java @@ -0,0 +1,12 @@ +package com.uncc.gameday.registration; + +public enum RatingChoices { + EMPTY ("EMP"), + SCATTERED ("SCT"), + BUSY ("BSY"), + FULL ("FLL"); + + String choice; + RatingChoices(String choice) { this.choice = choice; } + public String getValue() { return choice; } +} diff --git a/src/com/uncc/gameday/registration/RegistrationClient.java b/src/com/uncc/gameday/registration/RegistrationClient.java deleted file mode 100644 index c5d65b2..0000000 --- a/src/com/uncc/gameday/registration/RegistrationClient.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.uncc.gameday.registration; - -import java.util.List; - -import com.uncc.gameday.GameDay; -import com.uncc.gameday.R; - -/* Client used for interfacing with the server API */ - -public class RegistrationClient { - - private String serverName = GameDay.getAppContext().getString(R.string.server_hostname); - - public void registerAttendee(Attendee a) { - - } - - public List listAttendeeNames() { - // List all attendees to the game - - return null; - } - - public List listAttendeeNames(int begin, int end) { - // List attendees to the game supporting pagination - - return null; - } - - public Attendee getAttendee(int id) { - // Get the full information for a single attendee - - return null; - } - -}