frankfurter/lib/versions/v1/quote/interval.rb
BadMark d0a43e357a
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / publish (push) Has been cancelled
CI/CD Pipeline / release (push) Has been cancelled
up
2026-05-21 01:38:14 -06:00

38 lines
720 B
Ruby

# frozen_string_literal: true
require "versions/v1/quote/base"
module Versions
class V1 < Roda
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 "rate"
scope = Rate.where(provider: "ECB").between(date)
scope = scope.only(*(symbols + [base])) if symbols
scope.naked
end
end
end
end
end