Module: SpreeCmCommissioner::FirestoreConnection

Extended by:
ActiveSupport::Concern
Included in:
VotingSessions::PublishToFirestore
Defined in:
app/models/concerns/spree_cm_commissioner/firestore_connection.rb

Overview

Shared Cloud Firestore client construction.

The waiting-room services each inline this same pair (see WaitingGuestsCaller#firestore); this concern is the extracted version for new writers, plus a #firestore_available? guard so environments without the credential (dev, test, CI) no-op instead of raising on connect.

Instance Method Summary collapse

Instance Method Details

#firestoreObject



16
17
18
19
20
21
# File 'app/models/concerns/spree_cm_commissioner/firestore_connection.rb', line 16

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

#firestore_available?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/concerns/spree_cm_commissioner/firestore_connection.rb', line 12

def firestore_available?
  .present?
end

#service_accountObject



23
24
25
# File 'app/models/concerns/spree_cm_commissioner/firestore_connection.rb', line 23

def 
  @service_account ||= Rails.application.credentials.
end