Class LatestRates

java.lang.Object
net.thauvin.erik.frankfurter.LatestRates

public class LatestRates extends Object
Represents the latest exchange rates based on a specific base currency, date, and symbols.
Since:
0.9.0
Author:
Erik C. Thauvin
  • Constructor Details

    • LatestRates

      public LatestRates(LatestRates.Builder builder)
      Constructs a new LatestRates instance using the specified Builder.
      Parameters:
      builder - the Builder instance containing the base currency, date, and symbols to initialize the LatestRates object
  • Method Details

    • amount

      public Double amount()
      Retrieves the amount of the latest exchange rate or time series.
      Returns:
      a Double representing the amount
    • base

      public String base()
      Retrieves the base currency for the current rates or time series.
      Returns:
      a string representing the base currency
    • date

      public LocalDate date()
      Retrieves the date associated with the latest exchange rates.
      Returns:
      a LocalDate representing the date
    • exchangeRates

      Retrieves the latest exchange rates based on a specified base currency, date, and optional symbols.

      This method constructs a request to the Frankfurter API, fetches the data, and parses the response into a ExchangeRates object.

      Returns:
      an instance of ExchangeRates containing the base currency, date, and exchange rates
      Throws:
      IOException - if an error occurs during the API request or response handling
      URISyntaxException - if the URI syntax is invalid
      JsonSyntaxException - if the JSON response from the API does not match the expected format
      InterruptedException
    • symbols

      public List<String> symbols()
      Retrieves the list of currency symbols associated with the rates.
      Returns:
      a list of strings representing the currency symbols