package com.pennapps.labs.pennmobile.api;


import android.util.Log;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.message.BasicHeader;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import java.io.IOException;

public class DiningAPI extends API {

    public DiningAPI() {
        super();
        BASE_URL = "http://api.pennlabs.org/dining/";
    }

    public JSONObject getDiningInfo(String courseId) {
        HttpGet httpGet = new HttpGet(BASE_URL + courseId);
        httpGet.addHeader(new BasicHeader("Content-Type", "application/json; charset=utf-8"));

        try {
            HttpResponse response = httpClient.execute(httpGet);
            JSONTokener tokener = new JSONTokener(inputStreamToString
                    (response.getEntity().getContent()).toString());
            return new JSONObject(tokener);
        } catch (IOException e) {
            return null;
        } catch (JSONException e) {
            return null;
        }
    }

    public JSONObject getVenues() {
        HttpGet httpGet = new HttpGet(BASE_URL + "venues");
        try {
            HttpResponse response = httpClient.execute(httpGet);
            JSONTokener tokener = new JSONTokener(inputStreamToString
                    (response.getEntity().getContent()).toString());
            return new JSONObject(tokener);
        } catch (IOException e) {
            return null;
        } catch (JSONException e) {
            return null;
        }
    }

    public JSONObject getDailyMenu(int hallID) {
        HttpGet httpGet = new HttpGet(BASE_URL + "daily_menu/" + hallID);
        try {
            HttpResponse response = httpClient.execute(httpGet);
            JSONTokener tokener = new JSONTokener(inputStreamToString
                    (response.getEntity().getContent()).toString());
            return new JSONObject(tokener);
        } catch (IOException e) {
            return null;
        } catch (JSONException e) {
            return null;
        }
    }

    public JSONObject getWeeklyMenu(String hallID) {
        HttpGet httpGet = new HttpGet(BASE_URL + "weekly_menu/" + hallID);
        try {
            HttpResponse response = httpClient.execute(httpGet);
            JSONTokener tokener = new JSONTokener(inputStreamToString
                    (response.getEntity().getContent()).toString());
            return new JSONObject(tokener);
        } catch (IOException e) {
            return null;
        } catch (JSONException e) {
            return null;
        }
    }
}

@@ -41,34 +41,8 @@
 ;%0A%0A%0A
-import android.util.Log;%0A%0A
 impo
@@ -74,16 +74,16 @@
 sponse;%0A
+
 import o
@@ -125,52 +125,8 @@
 et;%0A
-import org.apache.http.message.BasicHeader;%0A
 impo
@@ -319,16 +319,16 @@
 uper();%0A
+
         
@@ -384,618 +384,8 @@
  %7D%0A%0A
-    public JSONObject getDiningInfo(String courseId) %7B%0A        HttpGet httpGet = new HttpGet(BASE_URL + courseId);%0A        httpGet.addHeader(new BasicHeader(%22Content-Type%22, %22application/json; charset=utf-8%22));%0A%0A        try %7B%0A            HttpResponse response = httpClient.execute(httpGet);%0A            JSONTokener tokener = new JSONTokener(inputStreamToString%0A                    (response.getEntity().getContent()).toString());%0A            return new JSONObject(tokener);%0A        %7D catch (IOException e) %7B%0A            return null;%0A        %7D catch (JSONException e) %7B%0A            return null;%0A        %7D%0A    %7D%0A%0A
     

Remove redundant method from Dining API