Class: SpreeCmCommissioner::WaitingRoomSessionFirebaseLogger

Inherits:
BaseInteractor
  • Object
show all
Defined in:
app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb

Instance Method Summary collapse

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb', line 7

def call
  current_date = room_session.created_at.strftime('%Y-%m-%d')
  document = firestore.col('waiting_guests')
                      .doc(current_date)
                      .col('records')
                      .doc(waiting_guest_firebase_doc_id)

  data = document.get.data.dup
  data[:entered_room_at] = room_session.created_at
  data[:page_path] = room_session.page_path
  data[:tenant_id] = room_session.tenant_id

  document.update(data)
end

#firestoreObject



22
23
24
# File 'app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb', line 22

def firestore
  @firestore ||= Google::Cloud::Firestore.new(project_id: [:project_id], credentials: )
end

#service_accountObject



26
27
28
# File 'app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb', line 26

def 
  Rails.application.credentials.
end