-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60006a2
commit 5d8ef27
Showing
4 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/java/com/europeanexchangerates/exchangeapi/provider/ExchangeRateProvider.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.europeanexchangerates.exchangeapi.provider; | ||
|
||
import java.time.LocalDate; | ||
import java.util.TreeMap; | ||
|
||
import com.europeanexchangerates.exchangeapi.dto.ExchangeRate; | ||
|
||
public interface ExchangeRateProvider { | ||
TreeMap<LocalDate, ExchangeRate> getExchangeRates() throws Exception; | ||
} |
24 changes: 24 additions & 0 deletions
24
...in/java/com/europeanexchangerates/exchangeapi/provider/UrlCsvZipExchangeRateProvider.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.europeanexchangerates.exchangeapi.provider; | ||
|
||
import java.time.LocalDate; | ||
import java.util.TreeMap; | ||
|
||
import com.europeanexchangerates.exchangeapi.dto.ExchangeRate; | ||
import com.europeanexchangerates.exchangeapi.util.DataDownloader; | ||
import com.europeanexchangerates.exchangeapi.util.UrlCsvZipDataDownloader; | ||
|
||
public class UrlCsvZipExchangeRateProvider implements ExchangeRateProvider { | ||
private DataDownloader downloader; | ||
|
||
public UrlCsvZipExchangeRateProvider() { | ||
this.downloader = new UrlCsvZipDataDownloader(); | ||
} | ||
|
||
public UrlCsvZipExchangeRateProvider(DataDownloader downloader) { | ||
this.downloader = downloader; | ||
} | ||
|
||
public TreeMap<LocalDate, ExchangeRate> getExchangeRates() throws Exception { | ||
return downloader.downloadData(); | ||
} | ||
} |
This file contains 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
This file contains 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