Class: Spree::StoreController

Inherits:
BaseController
  • Object
show all
Includes:
Core::ControllerHelpers::Order
Defined in:
app/controllers/spree/store_controller.rb

Instance Method Summary collapse

Instance Method Details

#api_tokensObject



21
22
23
24
25
26
# File 'app/controllers/spree/store_controller.rb', line 21

def api_tokens
  render json: {
    order_token: current_order&.token,
    oauth_token: current_oauth_token&.token
  }
end


16
17
18
19
# File 'app/controllers/spree/store_controller.rb', line 16

def cart_link
  render partial: 'spree/shared/link_to_cart'
  fresh_when(simple_current_order)
end

#ensure_cartObject



28
29
30
# File 'app/controllers/spree/store_controller.rb', line 28

def ensure_cart
  render json: current_order(create_order_if_necessary: true) # force creation of order if doesn't exists
end

#forbiddenObject



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

def forbidden
  render 'spree/shared/forbidden', layout: Spree::Config[:layout], status: 403
end

#unauthorizedObject



12
13
14
# File 'app/controllers/spree/store_controller.rb', line 12

def unauthorized
  render 'spree/shared/unauthorized', layout: Spree::Config[:layout], status: 401
end