Module: BookingSync::Engine::Models::Account::ClassMethods

Defined in:
lib/bookingsync/engine/models/account.rb

Instance Method Summary collapse

Instance Method Details

#find_by_host_and_synced_id(_host, synced_id) ⇒ Object



20
21
22
# File 'lib/bookingsync/engine/models/account.rb', line 20

def find_by_host_and_synced_id(_host, synced_id)
  find_by(synced_id: synced_id)
end

#from_omniauth(auth, _host) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/bookingsync/engine/models/account.rb', line 10

def from_omniauth(auth, _host)
   = find_or_initialize_by(synced_id: auth.uid, provider: auth.provider)

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