frankfurter/lib/quote/interval.rb
Hakan Ensari e5815737c1
Spring cleaning
- bumped gems
- rm bots
- rm pry byebug
- added rubocop-shopify and corrected generated warnings
2024-11-20 14:14:27 +01:00

35 lines
553 B
Ruby

# frozen_string_literal: true
require "quote/base"
module Quote
class Interval < Base
def formatted
{
amount:,
base:,
start_date: result.keys.first,
end_date: result.keys.last,
rates: result,
}
end
def cache_key
return if not_found?
Digest::MD5.hexdigest(result.keys.last)
end
private
def fetch_data
require "currency"
scope = Currency.between(date)
scope = scope.only(*(symbols + [base])) if symbols
scope.naked
end
end
end