Class: SpreeCmCommissioner::WaitingRoomSessionFirebaseLogger
- Inherits:
-
BaseInteractor
- Object
- BaseInteractor
- SpreeCmCommissioner::WaitingRoomSessionFirebaseLogger
- Defined in:
- app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
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 |
#firestore ⇒ Object
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: service_account[:project_id], credentials: service_account) end |
#service_account ⇒ Object
26 27 28 |
# File 'app/interactors/spree_cm_commissioner/waiting_room_session_firebase_logger.rb', line 26 def service_account Rails.application.credentials.cloud_firestore_service_account end |