@@ -0,0 +1,2883 @@
+%0Apackage app.iamin.iamin;%0A%0Aimport android.content.Context;%0Aimport android.os.AsyncTask;%0Aimport android.util.Log;%0A%0Aimport com.squareup.okhttp.Headers;%0Aimport com.squareup.okhttp.OkHttpClient;%0Aimport com.squareup.okhttp.Request;%0Aimport com.squareup.okhttp.Response;%0A%0Aimport java.io.IOException;%0A%0Aimport app.iamin.iamin.event.NeedsEvent;%0Aimport app.iamin.iamin.model.Need;%0Aimport app.iamin.iamin.model.User;%0Aimport app.iamin.iamin.util.EndpointUtils;%0A%0A/**%0A * Created by paul on 10/10/2015.%0A */%0Apublic class PullVolunteeringsTask extends AsyncTask%3CVoid, Integer, Need%5B%5D%3E %7B%0A    private static final String TAG = %22PullVolunteeringsTask%22;%0A%0A    private Context context;%0A%0A    public PullVolunteeringsTask(Context context) %7B%0A        this.context = context;%0A    %7D%0A%0A    @Override%0A    protected Need%5B%5D doInBackground(Void... params) %7B%0A%0A        User user = EndpointUtils.getUser(context);%0A        if (user.getEmail() == null) return null;%0A%0A%0A        Need%5B%5D needs = null;%0A        String url = EndpointUtils.getEndpoint(context);%0A        Log.d(TAG, url);%0A%0A        Headers headers = EndpointUtils.getHeaders(context);%0A/*%0A        Log.e(TAG, %22LOCAL Access-Token = %22 + headers.get(%22Access-Token%22));%0A        Log.e(TAG, %22LOCAL Token-Type = %22 + headers.get(%22Token-Type%22));%0A        Log.e(TAG, %22LOCAL Client = %22 + headers.get(%22Client%22));%0A        Log.e(TAG, %22LOCAL Expiry = %22 + headers.get(%22Expiry%22));%0A        Log.e(TAG, %22LOCAL Uid = %22 + headers.get(%22Uid%22));%0A*/%0A        try %7B%0A            OkHttpClient client = new OkHttpClient();%0A            Request request = new Request.Builder()%0A                    .headers(headers)%0A                    .url(url + %22users/%22 + user.getId() + %22/volunteerings%22)%0A            .build();%0A%0A            Response response = client.newCall(request).execute();%0A/*%0A            Log.e(TAG, %22Access-Token = %22 + response.headers().get(%22Access-Token%22));%0A            Log.e(TAG, %22Token-Type = %22 + response.headers().get(%22Token-Type%22));%0A            Log.e(TAG, %22Client = %22 + response.headers().get(%22Client%22));%0A            Log.e(TAG, %22Expiry = %22 + response.headers().get(%22Expiry%22));%0A            Log.e(TAG, %22Uid = %22 + response.headers().get(%22Uid%22));%0A*/%0A            EndpointUtils.storeHeader(context, response.headers());%0A%0A            String result = response.body().string();%0A            Log.e(TAG, %22RESULT: %22 + result);%0A/*%0A            JSONArray data = new JSONObject(result).getJSONArray(%22data%22);%0A%0A            needs = new Need%5Bdata.length()%5D;%0A            for (int i = 0; i %3C data.length(); i++) %7B%0A                JSONObject obj = data.getJSONObject(i);%0A                needs%5Bi%5D = new Need().fromJSON(context, obj);%0A            %7D%0A*/%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            return null;%0A        %7D%0A%0A        return needs;%0A    %7D%0A%0A    @Override%0A    protected void onPostExecute(Need%5B%5D needs) %7B%0A        BusProvider.getInstance().post(new NeedsEvent(needs));%0A    %7D%0A%7D

Delete NeedMock