module BookingSync::Engine::Models::Account::ClassMethods

Public Instance Methods

find_by_host_and_bookingsync_id_key(_host, bookingsync_id) click to toggle source
# File lib/bookingsync/engine/models/account.rb, line 20
def find_by_host_and_bookingsync_id_key(_host, bookingsync_id)
  find_by(BookingSyncEngine.bookingsync_id_key => bookingsync_id)
end
find_by_host_and_synced_id(_host, synced_id) click to toggle source

DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead.

# File lib/bookingsync/engine/models/account.rb, line 25
def find_by_host_and_synced_id(_host, synced_id)
  warn("DEPRECATED: find_by_host_and_synced_id is deprecated, use #find_by_host_and_bookingsync_id_key instead. It will be removed with the release of version 6 of this gem. Called from #{Gem.location_of_caller.join(":")}")
  find_by_host_and_bookingsync_id_key(nil, synced_id)
end
from_omniauth(auth, _host) click to toggle source
# File lib/bookingsync/engine/models/account.rb, line 10
def from_omniauth(auth, _host)
  account = find_or_initialize_by(BookingSyncEngine.bookingsync_id_key => auth.uid, provider: auth.provider)

  account.tap do |account|
    account.name = auth.info.business_name
    account.update_token(auth.credentials)
    account.save!
  end
end