1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/app/models/concerns/plaidable.rb

24 lines
515 B
Ruby
Raw Normal View History

module Plaidable
extend ActiveSupport::Concern
class_methods do
def plaid_provider
Provider::Plaid.new if Rails.application.config.plaid
end
def plaid_eu_provider
Provider::Plaid.new if Rails.application.config.plaid_eu
end
def plaid_provider_for(plaid_item)
return nil unless plaid_item
plaid_item.eu? ? plaid_eu_provider : plaid_provider
end
end
private
def plaid_provider_for(plaid_item)
self.class.plaid_provider_for(plaid_item)
end
end