mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02:30 +01:00
e5815737c1
- bumped gems - rm bots - rm pry byebug - added rubocop-shopify and corrected generated warnings
35 lines
541 B
Ruby
35 lines
541 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "quote/base"
|
|
require "digest"
|
|
|
|
module Quote
|
|
class EndOfDay < Base
|
|
def formatted
|
|
{
|
|
amount:,
|
|
base:,
|
|
date: result.keys.first,
|
|
rates: result.values.first,
|
|
}
|
|
end
|
|
|
|
def cache_key
|
|
return if not_found?
|
|
|
|
Digest::MD5.hexdigest(result.keys.first)
|
|
end
|
|
|
|
private
|
|
|
|
def fetch_data
|
|
require "currency"
|
|
|
|
scope = Currency.latest(date)
|
|
scope = scope.only(*(symbols + [base])) if symbols
|
|
|
|
scope.naked
|
|
end
|
|
end
|
|
end
|