private function download($currency, $date)
    {
        //use test data if running as test
        if ($this->runastest) {
            $results = file_get_contents(dirname(__FILE__) . '/../../tests/openExchangeTestData.json');
        }
        else {
            if ($this->settings['use-ssl']) {
                $url = 'https';
            } else {
                $url = 'http';
            }

            if ($date === date('Y-m-d')) {
                $url .= '://openexchangerates.org/api/latest.json?app_id=' . $this->settings['openex-app-id'] . '&base=' . $currency;
            } else {
                $url .= '://openexchangerates.org/api/time-series.json?app_id=' . $this->settings['openex-app-id'] . '&start=' . $date . '&end=' . $date . '&base=' . $currency;
            }
            $this->url = $url;
            $results = $this->connect($url);
        }

        return $results;
    }