// Path: src/main/java/com/github/vedenin/codingchallenge/exceptions/RestClientException.java
// public class RestClientException extends RuntimeException {
//     public RestClientException() {
//     }
// 
//     public RestClientException(String message) {
//         super(message);
//     }
// 
//     public RestClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public RestClientException(Throwable cause) {
//         super(cause);
//     }
// 
//     public RestClientException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/com/github/vedenin/codingchallenge/restclient/RestClient.java
// public interface RestClient {
//     BigDecimal getCurrentExchangeRates(CurrencyEnum currecnyFrom, CurrencyEnum currecnyTo);
//     BigDecimal getHistoricalExchangeRates(CurrencyEnum currencyFrom, CurrencyEnum currencyTo, Calendar calendar);
// }
// 
// Path: src/main/java/com/github/vedenin/codingchallenge/common/CurrencyEnum.java
// public enum CurrencyEnum {
//     EUR("EUR", "Euro (EUR)"),
//     USD("USD", "US Dollar (USD)"),
//     GBP("GBP", "British Pound (GBP)"),
//     NZD("NZD", "New Zealand Dollar (NZD)"),
//     AUD("AUD", "Australian Dollar (AUD)"),
//     JPY("JPY", "Japanese Yen (JPY)"),
//     HUF("HUF", "Hungarian Forint (HUF)"),
//     RUB("RUB", "Russian Ruble (RUB)"),
//     PLN("PLN", "Polish Zloty (PLN)");
//     private final String code;
//     private final String description;
// 
//     CurrencyEnum(String code, String description) {
//         this.code = code;
//         this.description = description;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// }


import com.github.vedenin.codingchallenge.exceptions.RestClientException;
import com.github.vedenin.codingchallenge.restclient.RestClient;
import com.github.vedenin.codingchallenge.common.CurrencyEnum;
import org.springframework.stereotype.Service;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.GregorianCalendar;
import static java.math.BigDecimal.ROUND_FLOOR;
package com.github.vedenin.codingchallenge.restclient.impl.openexchange;




/**
 * Created by slava on 04.02.17.
 */
@Service("OpenExchange")
public class OpenExchangeRestClient implements RestClient {
    private final static String URL_LAST = "https://openexchangerates.org/api/latest.json?";
    private final static String URL_HISTORY = "https://openexchangerates.org/api/historical/";
    private final static String API_ID = "20b5648a4f504982aba6464b13160704";
    private final static String API_ID_PRM = "app_id=";
    public static final String ERROR_WHILE_GATHERING_INFORMATION = "Error while gathering information from OpenExchange services";

// Path: src/main/java/com/github/vedenin/codingchallenge/exceptions/RestClientException.java
// public class RestClientException extends RuntimeException {
//     public RestClientException() {
//     }
// 
//     public RestClientException(String message) {
//         super(message);
//     }
// 
//     public RestClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public RestClientException(Throwable cause) {
//         super(cause);
//     }
// 
//     public RestClientException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/com/github/vedenin/codingchallenge/restclient/RestClient.java
// public interface RestClient {
//     BigDecimal getCurrentExchangeRates(CurrencyEnum currecnyFrom, CurrencyEnum currecnyTo);
//     BigDecimal getHistoricalExchangeRates(CurrencyEnum currencyFrom, CurrencyEnum currencyTo, Calendar calendar);
// }
// 
// Path: src/main/java/com/github/vedenin/codingchallenge/common/CurrencyEnum.java
// public enum CurrencyEnum {
//     EUR("EUR", "Euro (EUR)"),
//     USD("USD", "US Dollar (USD)"),
//     GBP("GBP", "British Pound (GBP)"),
//     NZD("NZD", "New Zealand Dollar (NZD)"),
//     AUD("AUD", "Australian Dollar (AUD)"),
//     JPY("JPY", "Japanese Yen (JPY)"),
//     HUF("HUF", "Hungarian Forint (HUF)"),
//     RUB("RUB", "Russian Ruble (RUB)"),
//     PLN("PLN", "Polish Zloty (PLN)");
//     private final String code;
//     private final String description;
// 
//     CurrencyEnum(String code, String description) {
//         this.code = code;
//         this.description = description;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// }


// Path: src/main/java/com/github/vedenin/codingchallenge/restclient/impl/openexchange/OpenExchangeRestClient.java
import com.github.vedenin.codingchallenge.exceptions.RestClientException;
import com.github.vedenin.codingchallenge.restclient.RestClient;
import com.github.vedenin.codingchallenge.common.CurrencyEnum;
import org.springframework.stereotype.Service;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.GregorianCalendar;
import static java.math.BigDecimal.ROUND_FLOOR;

package com.github.vedenin.codingchallenge.restclient.impl.openexchange;




/**
 * Created by slava on 04.02.17.
 */
@Service("OpenExchange")
public class OpenExchangeRestClient implements RestClient {
    private final static String URL_LAST = "https://openexchangerates.org/api/latest.json?";
    private final static String URL_HISTORY = "https://openexchangerates.org/api/historical/";
    private final static String API_ID = "20b5648a4f504982aba6464b13160704";
    private final static String API_ID_PRM = "app_id=";
    public static final String ERROR_WHILE_GATHERING_INFORMATION = "Error while gathering information from OpenExchange services";

    public BigDecimal getCurrentExchangeRates(CurrencyEnum currencyFrom, CurrencyEnum currencyTo) {