public static String create ( Map < String , String > properties ) throws RottenTomatoesException { if ( StringUtils . isBlank ( apiKey ) ) { throw new RottenTomatoesException ( ApiExceptionType . INVALID_URL , "Missing API Key" ) ; } StringBuilder urlBuilder = new StringBuilder ( API_SITE ) ; urlBuilder . append ( API_VERSION ) ; urlBuilder . append ( getUrlFromProps ( properties ) ) ; urlBuilder . append ( API_PREFIX ) . append ( apiKey ) ; for ( Map . Entry < String , String > property : properties . entrySet ( ) ) { // Validate the key/value if ( StringUtils . isNotBlank ( property . getKey ( ) ) && StringUtils . isNotBlank ( property . getValue ( ) ) ) { urlBuilder . append ( "&" ) . append ( property . getKey ( ) ) . append ( "=" ) . append ( property . getValue ( ) ) ; } } LOG . trace ( "URL: {}" , urlBuilder . toString ( ) ) ; return urlBuilder . toString ( ) ; }
Create the URL