Class: Spree::Admin::UberDirectCredentialsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Admin::UberDirectCredentialsController
- Defined in:
- app/controllers/spree/admin/uber_direct_credentials_controller.rb
Overview
Plain credential-entry form for the current store's Uber Direct sandbox/production OAuth application — not a "Connect" redirect dance. An admin creates the application in the Direct dashboard (direct.uber.com) once and pastes the values in here directly (encrypted at rest — see SpreeUberDirect::Credential). Same static-form convention as spree_doordash's own credentials controller, even though the underlying auth is OAuth2 under the hood (client_credentials, not an authorization-code redirect).
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
12 13 14 |
# File 'app/controllers/spree/admin/uber_direct_credentials_controller.rb', line 12 def show @credential = SpreeUberDirect::Credential.find_or_initialize_by(store: current_store) end |
#update ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spree/admin/uber_direct_credentials_controller.rb', line 16 def update @credential = SpreeUberDirect::Credential.find_or_initialize_by(store: current_store) if @credential.update(credential_params) flash[:success] = Spree.t(:uber_direct_credential_saved, default: 'Uber Direct credentials saved.') else flash[:error] = @credential.errors..to_sentence end redirect_to admin_uber_direct_credential_path end |