2024-03-27 09:16:00 -06:00
|
|
|
# `Providable` serves as an extension point for integrating multiple providers.
|
|
|
|
# For an example of a multi-provider, multi-concept implementation,
|
|
|
|
# see: https://github.com/maybe-finance/maybe/pull/561
|
|
|
|
|
|
|
|
module Providable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
2024-08-01 19:43:23 -04:00
|
|
|
def security_prices_provider
|
|
|
|
synth_provider
|
|
|
|
end
|
2024-07-08 09:04:59 -04:00
|
|
|
|
2024-08-01 19:43:23 -04:00
|
|
|
def exchange_rates_provider
|
|
|
|
synth_provider
|
2024-03-27 09:16:00 -06:00
|
|
|
end
|
2024-04-13 09:28:45 -04:00
|
|
|
|
|
|
|
def git_repository_provider
|
|
|
|
Provider::Github.new
|
|
|
|
end
|
2024-08-01 19:43:23 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def synth_provider
|
|
|
|
@synth_provider ||= begin
|
|
|
|
api_key = ENV["SYNTH_API_KEY"]
|
|
|
|
api_key.present? ? Provider::Synth.new(api_key) : nil
|
|
|
|
end
|
|
|
|
end
|
2024-03-27 09:16:00 -06:00
|
|
|
end
|
|
|
|
end
|