input: Write a python function to convert currency using an API.
  assert CurrencyConverter("USD", "EUR", 100).convert() == 84.3  # Assuming 1 USD = 0.843 EUR
  assert CurrencyConverter("GBP", "USD", 200).convert() == 280.0  # Assuming 1 GBP = 1.4 USD
  assert CurrencyConverter("JPY", "CAD", 1000).convert() == 11.5  # Assuming 1 JPY = 0.0115 CAD
output: import requests
  
  class CurrencyConverter:
      def __init__(self, from_currency, to_currency, amount):
          self.from_currency = from_currency
          self.to_currency = to_currency
          self.amount = amount
          self.api_url = "https://api.exchangerate-api.com/v4/latest/"
  
      def convert(self):
          response = requests.get(f"{self.api_url}{self.from_currency}")
          rates = response.json().get("rates")
          if rates and self.to_currency in rates:
              return round(self.amount * rates[self.to_currency], 2)
          else:
              raise ValueError("Currency not supported or API error")