From d6586d3ac9c735bbc4e76fd5628dea5474ed9a9a Mon Sep 17 00:00:00 2001 From: bspeice Date: Fri, 18 Oct 2013 17:46:37 -0400 Subject: [PATCH] Add the new (and tested!) RegistrationClient --- .../registration/RegistrationClient.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/com/uncc/gameday/registration/RegistrationClient.java diff --git a/src/com/uncc/gameday/registration/RegistrationClient.java b/src/com/uncc/gameday/registration/RegistrationClient.java new file mode 100644 index 0000000..e0a7cd8 --- /dev/null +++ b/src/com/uncc/gameday/registration/RegistrationClient.java @@ -0,0 +1,32 @@ +package com.uncc.gameday.registration; + +import java.util.List; + +import com.uncc.gameday.R; + +import android.content.Context; +import android.util.Log; +import retrofit.RestAdapter; +import retrofit.RetrofitError; + +public class RegistrationClient { + + private GamedayService gds; + + public RegistrationClient(Context c) { + RestAdapter ra = new RestAdapter.Builder() + .setServer("http://" + c.getString(R.string.server_hostname)) + .build(); + gds = ra.create(GamedayService.class); + } + + public List listLots() { + try { + return gds.listLots(); + } catch (RetrofitError e) { + Log.w("Registration.listLots()", e); + return null; + } + } + +}