Class: Spree::Admin::DoordashCredentialsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Admin::DoordashCredentialsController
- Defined in:
- app/controllers/spree/admin/doordash_credentials_controller.rb
Overview
Plain credential-entry form for the current store's DoorDash Drive access key — not an OAuth connect/disconnect flow like Square's. DoorDash Drive auth has no redirect dance: an admin creates an access key once in DoorDash's Developer Portal and pastes the three values in here directly (encrypted at rest — see SpreeDoordash::Credential).
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
9 10 11 |
# File 'app/controllers/spree/admin/doordash_credentials_controller.rb', line 9 def show @credential = SpreeDoordash::Credential.find_or_initialize_by(store: current_store) end |
#update ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/spree/admin/doordash_credentials_controller.rb', line 13 def update @credential = SpreeDoordash::Credential.find_or_initialize_by(store: current_store) if @credential.update(credential_params) flash[:success] = Spree.t(:doordash_credential_saved, default: 'DoorDash credentials saved.') else flash[:error] = @credential.errors..to_sentence end redirect_to admin_doordash_credential_path end |