Module: BookingSync::Engine::Models::MultiApplicationsAccount::ClassMethods
- Defined in:
- lib/bookingsync/engine/models/multi_applications_account.rb
Instance Method Summary collapse
- #find_by_host_and_bookingsync_id_key(host, bookingsync_id) ⇒ Object
-
#find_by_host_and_synced_id(host, synced_id) ⇒ Object
DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead.
- #from_omniauth(auth, host) ⇒ Object
Instance Method Details
#find_by_host_and_bookingsync_id_key(host, bookingsync_id) ⇒ Object
25 26 27 |
# File 'lib/bookingsync/engine/models/multi_applications_account.rb', line 25 def find_by_host_and_bookingsync_id_key(host, bookingsync_id) find_by(host: host, BookingSyncEngine.bookingsync_id_key => bookingsync_id) end |
#find_by_host_and_synced_id(host, synced_id) ⇒ Object
DEPRECATED: Please use find_by_host_and_bookingsync_id_key instead.
30 31 32 33 |
# File 'lib/bookingsync/engine/models/multi_applications_account.rb', line 30 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 5 of this gem. Called from #{Gem.location_of_caller.join(":")}") find_by_host_and_bookingsync_id_key(host, synced_id) end |
#from_omniauth(auth, host) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bookingsync/engine/models/multi_applications_account.rb', line 10 def from_omniauth(auth, host) if host.blank? raise ArgumentError, "The `host` variable must be passed when using BookingSync Engine with " \ "multi application support" end account = find_or_initialize_by(host: host, provider: auth.provider, BookingSyncEngine.bookingsync_id_key => auth.uid) account.tap do |account| account.name = auth.info.business_name account.update_token(auth.credentials) account.save! end end |