grjug/ChuckNorrisJokes — pull request #25 by shekibobo (2014-05-21 01:49:37+00:00)
Title: Return a Joke from the ApiControllers via callback

We abstract the important pieces into their own classes.

1. We have a `JokeCallback` that has a `success` and `failure` callback method.
2. We have a DAO that converts the data to an object.
3. We have the utility class (a service) that communicates with the server.

At this point it seems that we need about one less layer in all of this.
Discussions suggested that data conversion should happen in the controller,
but technically, the DAO is the method of accessing the data. Either way,
one of those layers probably needs to go, and is just needless abstraction.

We also remove the `getRandomJoke` methods, and add a constant `Joke.RANDOM_ID`.
The controller knows that when you pass the random id, it should use the
random endpoint. I'm not sure this is the ideal way to do it, but it seemed
better to use `Joke.RANDOM_ID` than `ChuckNorrisApiUtil.RANDOM_JOKE_ID` (the
activity would need to know too much about `Util`, which defeats the purpose
of all these layers).

Since the root URL is the same, and the resource path is the same,
we can just use `"random"` as the id instead of the actual integer `id`.