mirror of
https://github.com/we-promise/sure.git
synced 2026-04-10 07:44:48 +00:00
* Move provider config to family * remove global settings * Remove turbo auto submit * Fix flash location * Fix mssing syncer for lunchflow * Update schema.rb * FIX tests and encryption config * FIX make rabbit happy * FIX run migration in SQL * FIX turbo frame modal * Branding fixes * FIX rabbit * OCD with product names * More OCD * No other console.log|warn in codebase --------- Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
29 lines
625 B
Ruby
29 lines
625 B
Ruby
module Family::LunchflowConnectable
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
has_many :lunchflow_items, dependent: :destroy
|
|
end
|
|
|
|
def can_connect_lunchflow?
|
|
# Families can now configure their own Lunchflow credentials
|
|
true
|
|
end
|
|
|
|
def create_lunchflow_item!(api_key:, base_url: nil, item_name: nil)
|
|
lunchflow_item = lunchflow_items.create!(
|
|
name: item_name || "Lunch Flow Connection",
|
|
api_key: api_key,
|
|
base_url: base_url
|
|
)
|
|
|
|
lunchflow_item.sync_later
|
|
|
|
lunchflow_item
|
|
end
|
|
|
|
def has_lunchflow_credentials?
|
|
lunchflow_items.where.not(api_key: nil).exists?
|
|
end
|
|
end
|