Class: Spree::Admin::MenuChatCredentialsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/menu_chat_credentials_controller.rb

Overview

Plain credential-entry form for the current store's Gemini + Voyage AI API keys — not an OAuth connect/disconnect flow (neither service has one). Same shape as Spree::Admin::DoordashCredentialsController: an admin pastes the two key values in here directly, encrypted at rest.

Instance Method Summary collapse

Instance Method Details

#showObject



8
9
10
# File 'app/controllers/spree/admin/menu_chat_credentials_controller.rb', line 8

def show
  @credential = SpreeMenuChat::Credential.find_or_initialize_by(store: current_store)
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/spree/admin/menu_chat_credentials_controller.rb', line 12

def update
  @credential = SpreeMenuChat::Credential.find_or_initialize_by(store: current_store)

  if @credential.update(credential_params)
    flash[:success] = Spree.t(:menu_chat_credential_saved, default: 'Menu Chat credentials saved.')
  else
    flash[:error] = @credential.errors.full_messages.to_sentence
  end

  redirect_to admin_menu_chat_credential_path
end