Module: FxFetcher::ClassMethods
- Defined in:
- lib/fx_fetcher.rb
Instance Method Summary collapse
Instance Method Details
#at(date, base, counter) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/fx_fetcher.rb', line 9 def at(date, base, counter) if currency_present_for_date(date) search_for_rate(date, base, counter) else "No rates available for this date" end end |
#currencies ⇒ Object
17 18 19 20 21 22 |
# File 'lib/fx_fetcher.rb', line 17 def currencies currencies = [] rates_for_date = self.where(rate_date: self.first.rate_date) rates_for_date.each { |rate| currencies << rate.counter_currency } currencies << rates_for_date.first.base_currency end |
#valid_amount?(amount) ⇒ Boolean
24 25 26 |
# File 'lib/fx_fetcher.rb', line 24 def valid_amount?(amount) amount.to_f > 0.0 end |