Last active
          August 29, 2015 14:03 
        
      - 
      
 - 
        
Save algorythmist/c16b7a93b10e633ead69 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class HttpMovieService extends AbstractTomatoService implements | |
| MovieService { | |
| @Override | |
| public List<Movie> getBoxOfficeMovies(Locale country, int limit) | |
| throws IOException { | |
| String url = ROTTENTOMATOES_API + BOX_OFFICE_MOVIES; | |
| GenericUrl request = getMovieRequest(country, limit, url); | |
| HttpResponse response = executeRequest(request); | |
| MovieFeed feed = response.parseAs(MovieFeed.class); | |
| return feed.movies; | |
| } | |
| protected GenericUrl getMovieRequest(Locale country, int limit, String url) { | |
| GenericUrl request = new GenericUrl(url); | |
| request.set("apikey", getApiKey()); | |
| request.set("country", country.getCountry()); | |
| request.set("limit", limit); | |
| return request; | |
| } | |
| .... | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment